var Froogaloop=(function(){
function Froogaloop(iframe){
return new Froogaloop.fn.init(iframe);
}
var eventCallbacks={},
hasWindowEvent=false,
isReady=false,
slice=Array.prototype.slice,
playerDomain='';
Froogaloop.fn=Froogaloop.prototype={
element: null,
init: function(iframe){
if(typeof iframe==="string"){
iframe=document.getElementById(iframe);
}
this.element=iframe;
playerDomain=getDomainFromUrl(this.element.getAttribute('src'));
return this;
},
api: function(method, valueOrCallback){
if(!this.element||!method){
return false;
}
var self=this,
element=self.element,
target_id=element.id!=='' ? element.id:null,
params = !isFunction(valueOrCallback) ? valueOrCallback:null,
callback=isFunction(valueOrCallback) ? valueOrCallback:null;
if(callback){
storeCallback(method, callback, target_id);
}
postMessage(method, params, element);
return self;
},
addEvent: function(eventName, callback){
if(!this.element){
return false;
}
var self=this,
element=self.element,
target_id=element.id!=='' ? element.id:null;
storeCallback(eventName, callback, target_id);
if(eventName!='ready'){
postMessage('addEventListener', eventName, element);
}
else if(eventName=='ready'&&isReady){
callback.call(null, target_id);
}
return self;
},
removeEvent: function(eventName){
if(!this.element){
return false;
}
var self=this,
element=self.element,
target_id=element.id!=='' ? element.id:null,
removed=removeCallback(eventName, target_id);
if(eventName!='ready'&&removed){
postMessage('removeEventListener', eventName, element);
}}
};
function postMessage(method, params, target){
if(!target.contentWindow.postMessage){
return false;
}
var url=target.getAttribute('src').split('?')[0],
data=JSON.stringify({
method: method,
value: params
});
if(url.substr(0, 2)==='//'){
url=window.location.protocol + url;
}
target.contentWindow.postMessage(data, url);
}
function onMessageReceived(event){
var data, method;
try {
data=JSON.parse(event.data);
method=data.event||data.method;
}
catch(e){
}
if(method=='ready'&&!isReady){
isReady=true;
}
if(event.origin!=playerDomain){
return false;
}
var value=data.value,
eventData=data.data,
target_id=target_id==='' ? null:data.player_id,
callback=getCallback(method, target_id),
params=[];
if(!callback){
return false;
}
if(value!==undefined){
params.push(value);
}
if(eventData){
params.push(eventData);
}
if(target_id){
params.push(target_id);
}
return params.length > 0 ? callback.apply(null, params):callback.call();
}
function storeCallback(eventName, callback, target_id){
if(target_id){
if(!eventCallbacks[target_id]){
eventCallbacks[target_id]={};}
eventCallbacks[target_id][eventName]=callback;
}else{
eventCallbacks[eventName]=callback;
}}
function getCallback(eventName, target_id){
if(target_id){
return eventCallbacks[target_id][eventName];
}else{
return eventCallbacks[eventName];
}}
function removeCallback(eventName, target_id){
if(target_id&&eventCallbacks[target_id]){
if(!eventCallbacks[target_id][eventName]){
return false;
}
eventCallbacks[target_id][eventName]=null;
}else{
if(!eventCallbacks[eventName]){
return false;
}
eventCallbacks[eventName]=null;
}
return true;
}
function getDomainFromUrl(url){
if(url.substr(0, 2)==='//'){
url=window.location.protocol + url;
}
var url_pieces=url.split('/'),
domain_str='';
for(var i=0, length=url_pieces.length; i < length; i++){
if(i<3){domain_str +=url_pieces[i];}else{break;}
if(i<2){domain_str +='/';}}
return domain_str;
}
function isFunction(obj){
return !!(obj&&obj.constructor&&obj.call&&obj.apply);
}
function isArray(obj){
return toString.call(obj)==='[object Array]';
}
Froogaloop.fn.init.prototype=Froogaloop.fn;
if(window.addEventListener){
window.addEventListener('message', onMessageReceived, false);
}else{
window.attachEvent('onmessage', onMessageReceived);
}
return (window.Froogaloop=window.$f=Froogaloop);
})();
(function (){
function EventEmitter(){}
var proto=EventEmitter.prototype;
var exports=this;
var originalGlobalValue=exports.EventEmitter;
function indexOfListener(listeners, listener){
var i=listeners.length;
while (i--){
if(listeners[i].listener===listener){
return i;
}}
return -1;
}
function alias(name){
return function aliasClosure(){
return this[name].apply(this, arguments);
};}
proto.getListeners=function getListeners(evt){
var events=this._getEvents();
var response;
var key;
if(typeof evt==='object'){
response={};
for (key in events){
if(events.hasOwnProperty(key)&&evt.test(key)){
response[key]=events[key];
}}
}else{
response=events[evt]||(events[evt]=[]);
}
return response;
};
proto.flattenListeners=function flattenListeners(listeners){
var flatListeners=[];
var i;
for (i=0; i < listeners.length; i +=1){
flatListeners.push(listeners[i].listener);
}
return flatListeners;
};
proto.getListenersAsObject=function getListenersAsObject(evt){
var listeners=this.getListeners(evt);
var response;
if(listeners instanceof Array){
response={};
response[evt]=listeners;
}
return response||listeners;
};
proto.addListener=function addListener(evt, listener){
var listeners=this.getListenersAsObject(evt);
var listenerIsWrapped=typeof listener==='object';
var key;
for (key in listeners){
if(listeners.hasOwnProperty(key)&&indexOfListener(listeners[key], listener)===-1){
listeners[key].push(listenerIsWrapped ? listener:{
listener: listener,
once: false
});
}}
return this;
};
proto.on=alias('addListener');
proto.addOnceListener=function addOnceListener(evt, listener){
return this.addListener(evt, {
listener: listener,
once: true
});
};
proto.once=alias('addOnceListener');
proto.defineEvent=function defineEvent(evt){
this.getListeners(evt);
return this;
};
proto.defineEvents=function defineEvents(evts){
for (var i=0; i < evts.length; i +=1){
this.defineEvent(evts[i]);
}
return this;
};
proto.removeListener=function removeListener(evt, listener){
var listeners=this.getListenersAsObject(evt);
var index;
var key;
for (key in listeners){
if(listeners.hasOwnProperty(key)){
index=indexOfListener(listeners[key], listener);
if(index!==-1){
listeners[key].splice(index, 1);
}}
}
return this;
};
proto.off=alias('removeListener');
proto.addListeners=function addListeners(evt, listeners){
return this.manipulateListeners(false, evt, listeners);
};
proto.removeListeners=function removeListeners(evt, listeners){
return this.manipulateListeners(true, evt, listeners);
};
proto.manipulateListeners=function manipulateListeners(remove, evt, listeners){
var i;
var value;
var single=remove ? this.removeListener:this.addListener;
var multiple=remove ? this.removeListeners:this.addListeners;
if(typeof evt==='object'&&!(evt instanceof RegExp)){
for (i in evt){
if(evt.hasOwnProperty(i)&&(value=evt[i])){
if(typeof value==='function'){
single.call(this, i, value);
}else{
multiple.call(this, i, value);
}}
}}else{
i=listeners.length;
while (i--){
single.call(this, evt, listeners[i]);
}}
return this;
};
proto.removeEvent=function removeEvent(evt){
var type=typeof evt;
var events=this._getEvents();
var key;
if(type==='string'){
delete events[evt];
}
else if(type==='object'){
for (key in events){
if(events.hasOwnProperty(key)&&evt.test(key)){
delete events[key];
}}
}else{
delete this._events;
}
return this;
};
proto.removeAllListeners=alias('removeEvent');
proto.emitEvent=function emitEvent(evt, args){
var listeners=this.getListenersAsObject(evt);
var listener;
var i;
var key;
var response;
for (key in listeners){
if(listeners.hasOwnProperty(key)){
i=listeners[key].length;
while (i--){
listener=listeners[key][i];
if(listener.once===true){
this.removeListener(evt, listener.listener);
}
response=listener.listener.apply(this, args||[]);
if(response===this._getOnceReturnValue()){
this.removeListener(evt, listener.listener);
}}
}}
return this;
};
proto.trigger=alias('emitEvent');
proto.emit=function emit(evt){
var args=Array.prototype.slice.call(arguments, 1);
return this.emitEvent(evt, args);
};
proto.setOnceReturnValue=function setOnceReturnValue(value){
this._onceReturnValue=value;
return this;
};
proto._getOnceReturnValue=function _getOnceReturnValue(){
if(this.hasOwnProperty('_onceReturnValue')){
return this._onceReturnValue;
}else{
return true;
}};
proto._getEvents=function _getEvents(){
return this._events||(this._events={});
};
EventEmitter.noConflict=function noConflict(){
exports.EventEmitter=originalGlobalValue;
return EventEmitter;
};
if(typeof define==='function'&&define.amd){
define('eventEmitter/EventEmitter',[],function (){
return EventEmitter;
});
}
else if(typeof module==='object'&&module.exports){
module.exports=EventEmitter;
}else{
this.EventEmitter=EventEmitter;
}}.call(this));
(function(window){
var docElem=document.documentElement;
var bind=function(){};
function getIEEvent(obj){
var event=window.event;
event.target=event.target||event.srcElement||obj;
return event;
}
if(docElem.addEventListener){
bind=function(obj, type, fn){
obj.addEventListener(type, fn, false);
};}else if(docElem.attachEvent){
bind=function(obj, type, fn){
obj[ type + fn ]=fn.handleEvent ?
function(){
var event=getIEEvent(obj);
fn.handleEvent.call(fn, event);
} :
function(){
var event=getIEEvent(obj);
fn.call(obj, event);
};
obj.attachEvent("on" + type, obj[ type + fn ]);
};}
var unbind=function(){};
if(docElem.removeEventListener){
unbind=function(obj, type, fn){
obj.removeEventListener(type, fn, false);
};}else if(docElem.detachEvent){
unbind=function(obj, type, fn){
obj.detachEvent("on" + type, obj[ type + fn ]);
try {
delete obj[ type + fn ];
} catch(err){
obj[ type + fn ]=undefined;
}};}
var eventie={
bind: bind,
unbind: unbind
};
if(typeof define==='function'&&define.amd){
define('eventie/eventie',eventie);
}else{
window.eventie=eventie;
}})(this);
(function(window, factory){
if(typeof define==='function'&&define.amd){
define([
'eventEmitter/EventEmitter',
'eventie/eventie'
], function(EventEmitter, eventie){
return factory(window, EventEmitter, eventie);
});
}else if(typeof exports==='object'){
module.exports=factory(
window,
require('wolfy87-eventemitter'),
require('eventie')
);
}else{
window.imagesLoaded=factory(
window,
window.EventEmitter,
window.eventie
);
}})(window,
function factory(window, EventEmitter, eventie){
var $=window.jQuery;
var console=window.console;
var hasConsole=typeof console!=='undefined';
function extend(a, b){
for(var prop in b){
a[ prop ]=b[ prop ];
}
return a;
}
var objToString=Object.prototype.toString;
function isArray(obj){
return objToString.call(obj)==='[object Array]';
}
function makeArray(obj){
var ary=[];
if(isArray(obj)){
ary=obj;
}else if(typeof obj.length==='number'){
for(var i=0, len=obj.length; i < len; i++){
ary.push(obj[i]);
}}else{
ary.push(obj);
}
return ary;
}
function ImagesLoaded(elem, options, onAlways){
if(!(this instanceof ImagesLoaded)){
return new ImagesLoaded(elem, options);
}
if(typeof elem==='string'){
elem=document.querySelectorAll(elem);
}
this.elements=makeArray(elem);
this.options=extend({}, this.options);
if(typeof options==='function'){
onAlways=options;
}else{
extend(this.options, options);
}
if(onAlways){
this.on('always', onAlways);
}
this.getImages();
if($){
this.jqDeferred=new $.Deferred();
}
var _this=this;
setTimeout(function(){
_this.check();
});
}
ImagesLoaded.prototype=new EventEmitter();
ImagesLoaded.prototype.options={};
ImagesLoaded.prototype.getImages=function(){
this.images=[];
for(var i=0, len=this.elements.length; i < len; i++){
var elem=this.elements[i];
if(elem.nodeName==='IMG'){
this.addImage(elem);
}
var nodeType=elem.nodeType;
if(!nodeType||!(nodeType===1||nodeType===9||nodeType===11)){
continue;
}
var childElems=elem.querySelectorAll('img');
for(var j=0, jLen=childElems.length; j < jLen; j++){
var img=childElems[j];
this.addImage(img);
}}
};
ImagesLoaded.prototype.addImage=function(img){
var loadingImage=new LoadingImage(img);
this.images.push(loadingImage);
};
ImagesLoaded.prototype.check=function(){
var _this=this;
var checkedCount=0;
var length=this.images.length;
this.hasAnyBroken=false;
if(!length){
this.complete();
return;
}
function onConfirm(image, message){
if(_this.options.debug&&hasConsole){
console.log('confirm', image, message);
}
_this.progress(image);
checkedCount++;
if(checkedCount===length){
_this.complete();
}
return true;
}
for(var i=0; i < length; i++){
var loadingImage=this.images[i];
loadingImage.on('confirm', onConfirm);
loadingImage.check();
}};
ImagesLoaded.prototype.progress=function(image){
this.hasAnyBroken=this.hasAnyBroken||!image.isLoaded;
var _this=this;
setTimeout(function(){
_this.emit('progress', _this, image);
if(_this.jqDeferred&&_this.jqDeferred.notify){
_this.jqDeferred.notify(_this, image);
}});
};
ImagesLoaded.prototype.complete=function(){
var eventName=this.hasAnyBroken ? 'fail':'done';
this.isComplete=true;
var _this=this;
setTimeout(function(){
_this.emit(eventName, _this);
_this.emit('always', _this);
if(_this.jqDeferred){
var jqMethod=_this.hasAnyBroken ? 'reject':'resolve';
_this.jqDeferred[ jqMethod ](_this);
}});
};
if($){
$.fn.imagesLoaded=function(options, callback){
var instance=new ImagesLoaded(this, options, callback);
return instance.jqDeferred.promise($(this));
};}
function LoadingImage(img){
this.img=img;
}
LoadingImage.prototype=new EventEmitter();
LoadingImage.prototype.check=function(){
var resource=cache[ this.img.src ]||new Resource(this.img.src);
if(resource.isConfirmed){
this.confirm(resource.isLoaded, 'cached was confirmed');
return;
}
if(this.img.complete&&this.img.naturalWidth!==undefined){
this.confirm(this.img.naturalWidth!==0, 'naturalWidth');
return;
}
var _this=this;
resource.on('confirm', function(resrc, message){
_this.confirm(resrc.isLoaded, message);
return true;
});
resource.check();
};
LoadingImage.prototype.confirm=function(isLoaded, message){
this.isLoaded=isLoaded;
this.emit('confirm', this, message);
};
var cache={};
function Resource(src){
this.src=src;
cache[ src ]=this;
}
Resource.prototype=new EventEmitter();
Resource.prototype.check=function(){
if(this.isChecked){
return;
}
var proxyImage=new Image();
eventie.bind(proxyImage, 'load', this);
eventie.bind(proxyImage, 'error', this);
proxyImage.src=this.src;
this.isChecked=true;
};
Resource.prototype.handleEvent=function(event){
var method='on' + event.type;
if(this[ method ]){
this[ method ](event);
}};
Resource.prototype.onload=function(event){
this.confirm(true, 'onload');
this.unbindProxyEvents(event);
};
Resource.prototype.onerror=function(event){
this.confirm(false, 'onerror');
this.unbindProxyEvents(event);
};
Resource.prototype.confirm=function(isLoaded, message){
this.isConfirmed=true;
this.isLoaded=isLoaded;
this.emit('confirm', this, message);
};
Resource.prototype.unbindProxyEvents=function(event){
eventie.unbind(event.target, 'load', this);
eventie.unbind(event.target, 'error', this);
};
return ImagesLoaded;
});
(function (factory){
if(typeof define==='function'&&define.amd){
define(['jquery'], factory);
}else{
factory(jQuery);
}}(function ($, undefined){
'use strict';
$.infinitescroll=function infscr(options, callback, element){
this.element=$(element);
if(!this._create(options, callback)){
this.failed=true;
}};
$.infinitescroll.defaults={
loading: {
finished: undefined,
finishedMsg: "Congratulations, you've reached the end of the internet.",
img: 'data:image/gif;base64,R0lGODlh3AATAPQeAPDy+MnQ6LW/4N3h8MzT6rjC4sTM5r/I5NHX7N7j8c7U6tvg8OLl8uXo9Ojr9b3G5MfP6Ovu9tPZ7PT1+vX2+tbb7vf4+8/W69jd7rC73vn5/O/x+K243ai02////wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQECgD/ACwAAAAA3AATAAAF/6AnjmRpnmiqrmzrvnAsz3Rt33iu73zv/8CgcEj0BAScpHLJbDqf0Kh0Sq1ar9isdioItAKGw+MAKYMFhbF63CW438f0mg1R2O8EuXj/aOPtaHx7fn96goR4hmuId4qDdX95c4+RBIGCB4yAjpmQhZN0YGYGXitdZBIVGAsLoq4BBKQDswm1CQRkcG6ytrYKubq8vbfAcMK9v7q7EMO1ycrHvsW6zcTKsczNz8HZw9vG3cjTsMIYqQkCLBwHCgsMDQ4RDAYIqfYSFxDxEfz88/X38Onr16+Bp4ADCco7eC8hQYMAEe57yNCew4IVBU7EGNDiRn8Z831cGLHhSIgdFf9chIeBg7oA7gjaWUWTVQAGE3LqBDCTlc9WOHfm7PkTqNCh54rePDqB6M+lR536hCpUqs2gVZM+xbrTqtGoWqdy1emValeXKzggYBBB5y1acFNZmEvXAoN2cGfJrTv3bl69Ffj2xZt3L1+/fw3XRVw4sGDGcR0fJhxZsF3KtBTThZxZ8mLMgC3fRatCbYMNFCzwLEqLgE4NsDWs/tvqdezZf13Hvk2A9Szdu2X3pg18N+68xXn7rh1c+PLksI/Dhe6cuO3ow3NfV92bdArTqC2Ebd3A8vjf5QWfH6Bg7Nz17c2fj69+fnq+8N2Lty+fuP78/eV2X13neIcCeBRwxorbZrA1ANoCDGrgoG8RTshahQ9iSKEEzUmYIYfNWViUhheCGJyIP5E4oom7WWjgCeBFAJNv1DVV01MAdJhhjdkplWNzO/5oXI846njjVEIqR2OS2B1pE5PVscajkxhMycqLJghQSwT40PgfAl4GqNSXYdZXJn5gSkmmmmJu1aZYb14V51do+pTOCmA40AqVCIhG5IJ9PvYnhIFOxmdqhpaI6GeHCtpooisuutmg+Eg62KOMKuqoTaXgicQWoIYq6qiklmoqFV0UoeqqrLbq6quwxirrrLTWauutJ4QAACH5BAUKABwALAcABADOAAsAAAX/IPd0D2dyRCoUp/k8gpHOKtseR9yiSmGbuBykler9XLAhkbDavXTL5k2oqFqNOxzUZPU5YYZd1XsD72rZpBjbeh52mSNnMSC8lwblKZGwi+0QfIJ8CncnCoCDgoVnBHmKfByGJimPkIwtiAeBkH6ZHJaKmCeVnKKTHIihg5KNq4uoqmEtcRUtEREMBggtEr4QDrjCuRC8h7/BwxENeicSF8DKy82pyNLMOxzWygzFmdvD2L3P0dze4+Xh1Arkyepi7dfFvvTtLQkZBC0T/FX3CRgCMOBHsJ+EHYQY7OinAGECgQsB+Lu3AOK+CewcWjwxQeJBihtNGHSoQOE+iQ3//4XkwBBhRZMcUS6YSXOAwIL8PGqEaSJCiYt9SNoCmnJPAgUVLChdaoFBURN8MAzl2PQphwQLfDFd6lTowglHve6rKpbjhK7/pG5VinZP1qkiz1rl4+tr2LRwWU64cFEihwEtZgbgR1UiHaMVvxpOSwBA37kzGz9e8G+B5MIEKLutOGEsAH2ATQwYfTmuX8aETWdGPZmiZcccNSzeTCA1Sw0bdiitC7LBWgu8jQr8HRzqgpK6gX88QbrB14z/kF+ELpwB8eVQj/JkqdylAudji/+ts3039vEEfK8Vz2dlvxZKG0CmbkKDBvllRd6fCzDvBLKBDSCeffhRJEFebFk1k/Mv9jVIoIJZSeBggwUaNeB+Qk34IE0cXlihcfRxkOAJFFhwGmKlmWDiakZhUJtnLBpnWWcnKaAZcxI0piFGGLBm1mc90kajSCveeBVWKeYEoU2wqeaQi0PetoE+rr14EpVC7oAbAUHqhYExbn2XHHsVqbcVew9tx8+XJKk5AZsqqdlddGpqAKdbAYBn1pcczmSTdWvdmZ17c1b3FZ99vnTdCRFM8OEcAhLwm1NdXnWcBBSMRWmfkWZqVlsmLIiAp/o1gGV2vpS4lalGYsUOqXrddcKCmK61aZ8SjEpUpVFVoCpTj4r661Km7kBHjrDyc1RAIQAAIfkEBQoAGwAsBwAEAM4ACwAABf/gtmUCd4goQQgFKj6PYKi0yrrbc8i4ohQt12EHcal+MNSQiCP8gigdz7iCioaCIvUmZLp8QBzW0EN2vSlCuDtFKaq4RyHzQLEKZNdiQDhRDVooCwkbfm59EAmKi4SGIm+AjIsKjhsqB4mSjT2IOIOUnICeCaB/mZKFNTSRmqVpmJqklSqskq6PfYYCDwYHDC4REQwGCBLGxxIQDsHMwhAIX8bKzcENgSLGF9PU1j3Sy9zX2NrgzQziChLk1BHWxcjf7N046tvN82715czn9Pryz6Ilc4ACj4EBOCZM8KEnAYYADBRKnACAYUMFv1wotIhCEcaJCisqwJFgAUSQGyX/kCSVUUTIdKMwJlyo0oXHlhskwrTJciZHEXsgaqS4s6PJiCAr1uzYU8kBBSgnWFqpoMJMUjGtDmUwkmfVmVypakWhEKvXsS4nhLW5wNjVroJIoc05wSzTr0PtiigpYe4EC2vj4iWrFu5euWIMRBhacaVJhYQBEFjA9jHjyQ0xEABwGceGAZYjY0YBOrRLCxUp29QM+bRkx5s7ZyYgVbTqwwti2ybJ+vLtDYpycyZbYOlptxdx0kV+V7lC5iJAyyRrwYKxAdiz82ng0/jnAdMJFz0cPi104Ec1Vj9/M6F173vKL/feXv156dw11tlqeMMnv4V5Ap53GmjQQH97nFfg+IFiucfgRX5Z8KAgbUlQ4IULIlghhhdOSB6AgX0IVn8eReghen3NRIBsRgnH4l4LuEidZBjwRpt6NM5WGwoW0KSjCwX6yJSMab2GwwAPDXfaBCtWpluRTQqC5JM5oUZAjUNS+VeOLWpJEQ7VYQANW0INJSZVDFSnZphjSikfmzE5N4EEbQI1QJmnWXCmHulRp2edwDXF43txukenJwvI9xyg9Q26Z3MzGUcBYFEChZh6DVTq34AU8Iflh51Sd+CnKFYQ6mmZkhqfBKfSxZWqA9DZanWjxmhrWwi0qtCrt/43K6WqVjjpmhIqgEGvculaGKklKstAACEAACH5BAUKABwALAcABADOAAsAAAX/ICdyQmaMYyAUqPgIBiHPxNpy79kqRXH8wAPsRmDdXpAWgWdEIYm2llCHqjVHU+jjJkwqBTecwItShMXkEfNWSh8e1NGAcLgpDGlRgk7EJ/6Ae3VKfoF/fDuFhohVeDeCfXkcCQqDVQcQhn+VNDOYmpSWaoqBlUSfmowjEA+iEAEGDRGztAwGCDcXEA60tXEiCrq8vREMEBLIyRLCxMWSHMzExnbRvQ2Sy7vN0zvVtNfU2tLY3rPgLdnDvca4VQS/Cpk3ABwSLQkYAQwT/P309vcI7OvXr94jBQMJ/nskkGA/BQBRLNDncAIAiDcG6LsxAWOLiQzmeURBKWSLCQbv/1F0eDGinJUKR47YY1IEgQASKk7Yc7ACRwZm7mHweRJoz59BJUogisKCUaFMR0x4SlJBVBFTk8pZivTR0K73rN5wqlXEAq5Fy3IYgHbEzQ0nLy4QSoCjXLoom96VOJEeCosK5n4kkFfqXjl94wa+l1gvAcGICbewAOAxY8l/Ky/QhAGz4cUkGxu2HNozhwMGBnCUqUdBg9UuW9eUynqSwLHIBujePef1ZGQZXcM+OFuEBeBhi3OYgLyqcuaxbT9vLkf4SeqyWxSQpKGB2gQpm1KdWbu72rPRzR9Ne2Nu9Kzr/1Jqj0yD/fvqP4aXOt5sW/5qsXXVcv1Nsp8IBUAmgswGF3llGgeU1YVXXKTN1FlhWFXW3gIE+DVChApysACHHo7Q4A35lLichh+ROBmLKAzgYmYEYDAhCgxKGOOMn4WR4kkDaoBBOxJtdNKQxFmg5JIWIBnQc07GaORfUY4AEkdV6jHlCEISSZ5yTXpp1pbGZbkWmcuZmQCaE6iJ0FhjMaDjTMsgZaNEHFRAQVp3bqXnZED1qYcECOz5V6BhSWCoVJQIKuKQi2KFKEkEFAqoAo7uYSmO3jk61wUUMKmknJ4SGimBmAa0qVQBhAAAIfkEBQoAGwAsBwAEAM4ACwAABf/gJm5FmRlEqhJC+bywgK5pO4rHI0D3pii22+Mg6/0Ej96weCMAk7cDkXf7lZTTnrMl7eaYoy10JN0ZFdco0XAuvKI6qkgVFJXYNwjkIBcNBgR8TQoGfRsJCRuCYYQQiI+ICosiCoGOkIiKfSl8mJkHZ4U9kZMbKaI3pKGXmJKrngmug4WwkhA0lrCBWgYFCCMQFwoQDRHGxwwGCBLMzRLEx8iGzMMO0cYNeCMKzBDW19lnF9DXDIY/48Xg093f0Q3s1dcR8OLe8+Y91OTv5wrj7o7B+7VNQqABIoRVCMBggsOHE36kSoCBIcSH3EbFangxogJYFi8CkJhqQciLJEf/LDDJEeJIBT0GsOwYUYJGBS0fjpQAMidGmyVP6sx4Y6VQhzs9VUwkwqaCCh0tmKoFtSMDmBOf9phg4SrVrROuasRQAaxXpVUhdsU6IsECZlvX3kwLUWzRt0BHOLTbNlbZG3vZinArge5Dvn7wbqtQkSYAAgtKmnSsYKVKo2AfW048uaPmG386i4Q8EQMBAIAnfB7xBxBqvapJ9zX9WgRS2YMpnvYMGdPK3aMjt/3dUcNI4blpj7iwkMFWDXDvSmgAlijrt9RTR78+PS6z1uAJZIe93Q8g5zcsWCi/4Y+C8bah5zUv3vv89uft30QP23punGCx5954oBBwnwYaNCDY/wYrsYeggnM9B2Fpf8GG2CEUVWhbWAtGouEGDy7Y4IEJVrbSiXghqGKIo7z1IVcXIkKWWR361QOLWWnIhwERpLaaCCee5iMBGJQmJGyPFTnbkfHVZGRtIGrg5HALEJAZbu39BuUEUmq1JJQIPtZilY5hGeSWsSk52G9XqsmgljdIcABytq13HyIM6RcUA+r1qZ4EBF3WHWB29tBgAzRhEGhig8KmqKFv8SeCeo+mgsF7YFXa1qWSbkDpom/mqR1PmHCqJ3fwNRVXjC7S6CZhFVCQ2lWvZiirhQq42SACt25IK2hv8TprriUV1usGgeka7LFcNmCldMLi6qZMgFLgpw16Cipb7bC1knXsBiEAACH5BAUKABsALAcABADOAAsAAAX/4FZsJPkUmUGsLCEUTywXglFuSg7fW1xAvNWLF6sFFcPb42C8EZCj24EJdCp2yoegWsolS0Uu6fmamg8n8YYcLU2bXSiRaXMGvqV6/KAeJAh8VgZqCX+BexCFioWAYgqNi4qAR4ORhRuHY408jAeUhAmYYiuVlpiflqGZa5CWkzc5fKmbbhIpsAoQDRG8vQwQCBLCwxK6vb5qwhfGxxENahvCEA7NzskSy7vNzzzK09W/PNHF1NvX2dXcN8K55cfh69Luveol3vO8zwi4Yhj+AQwmCBw4IYclDAAJDlQggVOChAoLKkgFkSCAHDwWLKhIEOONARsDKryogFPIiAUb/95gJNIiw4wnI778GFPhzBKFOAq8qLJEhQpiNArjMcHCmlTCUDIouTKBhApELSxFWiGiVKY4E2CAekPgUphDu0742nRrVLJZnyrFSqKQ2ohoSYAMW6IoDpNJ4bLdILTnAj8KUF7UeENjAKuDyxIgOuGiOI0EBBMgLNew5AUrDTMGsFixwBIaNCQuAXJB57qNJ2OWm2Aj4skwCQCIyNkhhtMkdsIuodE0AN4LJDRgfLPtn5YDLdBlraAByuUbBgxQwICxMOnYpVOPej074OFdlfc0TqC62OIbcppHjV4o+LrieWhfT8JC/I/T6W8oCl29vQ0XjLdBaA3s1RcPBO7lFvpX8BVoG4O5jTXRQRDuJ6FDTzEWF1/BCZhgbyAKE9qICYLloQYOFtahVRsWYlZ4KQJHlwHS/IYaZ6sZd9tmu5HQm2xi1UaTbzxYwJk/wBF5g5EEYOBZeEfGZmNdFyFZmZIR4jikbLThlh5kUUVJGmRT7sekkziRWUIACABk3T4qCsedgO4xhgGcY7q5pHJ4klBBTQRJ0CeHcoYHHUh6wgfdn9uJdSdMiebGJ0zUPTcoS286FCkrZxnYoYYKWLkBowhQoBeaOlZAgVhLidrXqg2GiqpQpZ4apwSwRtjqrB3muoF9BboaXKmshlqWqsWiGt2wphJkQbAU5hoCACH5BAUKABsALAcABADOAAsAAAX/oGFw2WZuT5oZROsSQnGaKjRvilI893MItlNOJ5v5gDcFrHhKIWcEYu/xFEqNv6B1N62aclysF7fsZYe5aOx2yL5aAUGSaT1oTYMBwQ5VGCAJgYIJCnx1gIOBhXdwiIl7d0p2iYGQUAQBjoOFSQR/lIQHnZ+Ue6OagqYzSqSJi5eTpTxGcjcSChANEbu8DBAIEsHBChe5vL13G7fFuscRDcnKuM3H0La3EA7Oz8kKEsXazr7Cw9/Gztar5uHHvte47MjktznZ2w0G1+D3BgirAqJmJMAQgMGEgwgn5Ei0gKDBhBMALGRYEOJBb5QcWlQo4cbAihZz3GgIMqFEBSM1/4ZEOWPAgpIIJXYU+PIhRG8ja1qU6VHlzZknJNQ6UanCjQkWCIGSUGEjAwVLjc44+DTqUQtPPS5gejUrTa5TJ3g9sWCr1BNUWZI161StiQUDmLYdGfesibQ3XMq1OPYthrwuA2yU2LBs2cBHIypYQPPlYAKFD5cVvNPtW8eVGbdcQADATsiNO4cFAPkvHpedPzc8kUcPgNGgZ5RNDZG05reoE9s2vSEP79MEGiQGy1qP8LA4ZcdtsJE48ONoLTBtTV0B9LsTnPceoIDBDQvS7W7vfjVY3q3eZ4A339J4eaAmKqU/sV58HvJh2RcnIBsDUw0ABqhBA5aV5V9XUFGiHfVeAiWwoFgJJrIXRH1tEMiDFV4oHoAEGlaWhgIGSGBO2nFomYY3mKjVglidaNYJGJDkWW2xxTfbjCbVaOGNqoX2GloR8ZeTaECS9pthRGJH2g0b3Agbk6hNANtteHD2GJUucfajCQBy5OOTQ25ZgUPvaVVQmbKh9510/qQpwXx3SQdfk8tZJOd5b6JJFplT3ZnmmX3qd5l1eg5q00HrtUkUn0AKaiGjClSAgKLYZcgWXwocGRcCFGCKwSB6ceqphwmYRUFYT/1WKlOdUpipmxW0mlCqHjYkAaeoZlqrqZ4qd+upQKaapn/AmgAegZ8KUtYtFAQQAgAh+QQFCgAbACwHAAQAzgALAAAF/+C2PUcmiCiZGUTrEkKBis8jQEquKwU5HyXIbEPgyX7BYa5wTNmEMwWsSXsqFbEh8DYs9mrgGjdK6GkPY5GOeU6ryz7UFopSQEzygOGhJBjoIgMDBAcBM0V/CYqLCQqFOwobiYyKjn2TlI6GKC2YjJZknouaZAcQlJUHl6eooJwKooobqoewrJSEmyKdt59NhRKFMxLEEA4RyMkMEAjDEhfGycqAG8TQx9IRDRDE3d3R2ctD1RLg0ttKEnbY5wZD3+zJ6M7X2RHi9Oby7u/r9g38UFjTh2xZJBEBMDAboogAgwkQI07IMUORwocSJwCgWDFBAIwZOaJIsOBjRogKJP8wTODw5ESVHVtm3AhzpEeQElOuNDlTZ0ycEUWKWFASqEahGwYUPbnxoAgEdlYSqDBkgoUNClAlIHbSAoOsqCRQnQHxq1axVb06FWFxLIqyaze0Tft1JVqyE+pWXMD1pF6bYl3+HTqAWNW8cRUFzmih0ZAAB2oGKukSAAGGRHWJgLiR6AylBLpuHKKUMlMCngMpDSAa9QIUggZVVvDaJobLeC3XZpvgNgCmtPcuwP3WgmXSq4do0DC6o2/guzcseECtUoO0hmcsGKDgOt7ssBd07wqesAIGZC1YIBa7PQHvb1+SFo+++HrJSQfB33xfav3i5eX3Hnb4CTJgegEq8tH/YQEOcIJzbm2G2EoYRLgBXFpVmFYDcREV4HIcnmUhiGBRouEMJGJGzHIspqgdXxK0yCKHRNXoIX4uorCdTyjkyNtdPWrA4Up82EbAbzMRxxZRR54WXVLDIRmRcag5d2R6ugl3ZXzNhTecchpMhIGVAKAYpgJjjsSklBEd99maZoo535ZvdamjBEpusJyctg3h4X8XqodBMx0tiNeg/oGJaKGABpogS40KSqiaEgBqlQWLUtqoVQnytekEjzo0hHqhRorppOZt2p923M2AAV+oBtpAnnPNoB6HaU6mAAIU+IXmi3j2mtFXuUoHKwXpzVrsjcgGOauKEjQrwq157hitGq2NoWmjh7z6Wmxb0m5w66+2VRAuXN/yFUAIACH5BAUKABsALAcABADOAAsAAAX/4CZuRiaM45MZqBgIRbs9AqTcuFLE7VHLOh7KB5ERdjJaEaU4ClO/lgKWjKKcMiJQ8KgumcieVdQMD8cbBeuAkkC6LYLhOxoQ2PF5Ys9PKPBMen17f0CCg4VSh32JV4t8jSNqEIOEgJKPlkYBlJWRInKdiJdkmQlvKAsLBxdABA4RsbIMBggtEhcQsLKxDBC2TAS6vLENdJLDxMZAubu8vjIbzcQRtMzJz79S08oQEt/guNiyy7fcvMbh4OezdAvGrakLAQwyABsELQkY9BP+//ckyPDD4J9BfAMh1GsBoImMeQUN+lMgUJ9CiRMa5msxoB9Gh/o8GmxYMZXIgxtR/yQ46S/gQAURR0pDwYDfywoyLPip5AdnCwsMFPBU4BPFhKBDi444quCmDKZOfwZ9KEGpCKgcN1jdALSpPqIYsabS+nSqvqplvYqQYAeDPgwKwjaMtiDl0oaqUAyo+3TuWwUAMPpVCfee0cEjVBGQq2ABx7oTWmQk4FglZMGN9fGVDMCuiH2AOVOu/PmyxM630gwM0CCn6q8LjVJ8GXvpa5Uwn95OTC/nNxkda1/dLSK475IjCD6dHbK1ZOa4hXP9DXs5chJ00UpVm5xo2qRpoxptwF2E4/IbJpB/SDz9+q9b1aNfQH08+p4a8uvX8B53fLP+ycAfemjsRUBgp1H20K+BghHgVgt1GXZXZpZ5lt4ECjxYR4ScUWiShEtZqBiIInRGWnERNnjiBglw+JyGnxUmGowsyiiZg189lNtPGACjV2+S9UjbU0JWF6SPvEk3QZEqsZYTk3UAaRSUnznJI5LmESCdBVSyaOWUWLK4I5gDUYVeV1T9l+FZClCAUVA09uSmRHBCKAECFEhW51ht6rnmWBXkaR+NjuHpJ40D3DmnQXt2F+ihZxlqVKOfQRACACH5BAUKABwALAcABADOAAsAAAX/ICdyUCkUo/g8mUG8MCGkKgspeC6j6XEIEBpBUeCNfECaglBcOVfJFK7YQwZHQ6JRZBUqTrSuVEuD3nI45pYjFuWKvjjSkCoRaBUMWxkwBGgJCXspQ36Bh4EEB0oKhoiBgyNLjo8Ki4QElIiWfJqHnISNEI+Ql5J9o6SgkqKkgqYihamPkW6oNBgSfiMMDQkGCBLCwxIQDhHIyQwQCGMKxsnKVyPCF9DREQ3MxMPX0cu4wt7J2uHWx9jlKd3o39MiuefYEcvNkuLt5O8c1ePI2tyELXGQwoGDAQf+iEC2xByDCRAjTlAgIUWCBRgCPJQ4AQBFXAs0coT40WLIjRxL/47AcHLkxIomRXL0CHPERZkpa4q4iVKiyp0tR/7kwHMkTUBBJR5dOCEBAVcKKtCAyOHpowXCpk7goABqBZdcvWploACpBKkpIJI1q5OD2rIWE0R1uTZu1LFwbWL9OlKuWb4c6+o9i3dEgw0RCGDUG9KlRw56gDY2qmCByZBaASi+TACA0TucAaTteCcy0ZuOK3N2vJlx58+LRQyY3Xm0ZsgjZg+oPQLi7dUcNXi0LOJw1pgNtB7XG6CBy+U75SYfPTSQAgZTNUDnQHt67wnbZyvwLgKiMN3oCZB3C76tdewpLFgIP2C88rbi4Y+QT3+8S5USMICZXWj1pkEDeUU3lOYGB3alSoEiMIjgX4WlgNF2EibIwQIXauWXSRg2SAOHIU5IIIMoZkhhWiJaiFVbKo6AQEgQXrTAazO1JhkBrBG3Y2Y6EsUhaGn95hprSN0oWpFE7rhkeaQBchGOEWnwEmc0uKWZj0LeuNV3W4Y2lZHFlQCSRjTIl8uZ+kG5HU/3sRlnTG2ytyadytnD3HrmuRcSn+0h1dycexIK1KCjYaCnjCCVqOFFJTZ5GkUUjESWaUIKU2lgCmAKKQIUjHapXRKE+t2og1VgankNYnohqKJ2CmKplso6GKz7WYCgqxeuyoF8u9IQAgA7',
msg: null,
msgText: 'Loading the next set of posts...',
selector: null,
speed: 'fast',
start: undefined
},
state: {
isDuringAjax: false,
isInvalidPage: false,
isDestroyed: false,
isDone: false,
isPaused: false,
isBeyondMaxPage: false,
currPage: 1
},
debug: false,
behavior: undefined,
binder: $(window),
nextSelector: 'div.navigation a:first',
navSelector: 'div.navigation',
contentSelector: null,
extraScrollPx: 150,
itemSelector: 'div.post',
animate: false,
pathParse: undefined,
dataType: 'html',
appendCallback: true,
bufferPx: 40,
errorCallback: function (){ },
infid: 0,
pixelsFromNavToBottom: undefined,
path: undefined,
prefill: false,
maxPage: undefined
};
$.infinitescroll.prototype={
_binding: function infscr_binding(binding){
var instance=this,
opts=instance.options;
opts.v='2.0b2.120520';
if(!!opts.behavior&&this['_binding_'+opts.behavior]!==undefined){
this['_binding_'+opts.behavior].call(this);
return;
}
if(binding!=='bind'&&binding!=='unbind'){
this._debug('Binding value ' + binding + ' not valid');
return false;
}
if(binding==='unbind'){
(this.options.binder).unbind('smartscroll.infscr.' + instance.options.infid);
}else{
(this.options.binder)[binding]('smartscroll.infscr.' + instance.options.infid, function (){
instance.scroll();
});
}
this._debug('Binding', binding);
},
_create: function infscr_create(options, callback){
var opts=$.extend(true, {}, $.infinitescroll.defaults, options);
this.options=opts;
var $window=$(window);
var instance=this;
if(!instance._validate(options)){
return false;
}
var path=$(opts.nextSelector).attr('href');
if(!path){
this._debug('Navigation selector not found');
return false;
}
opts.path=opts.path||this._determinepath(path);
opts.contentSelector=opts.contentSelector||this.element;
opts.loading.selector=opts.loading.selector||opts.contentSelector;
opts.loading.msg=opts.loading.msg||$('
' + opts.loading.msgText + '
');
(new Image()).src=opts.loading.img;
if(opts.pixelsFromNavToBottom===undefined){
opts.pixelsFromNavToBottom=$(document).height() - $(opts.navSelector).offset().top;
this._debug('pixelsFromNavToBottom: ' + opts.pixelsFromNavToBottom);
}
var self=this;
opts.loading.start=opts.loading.start||function(){
$(opts.navSelector).hide();
opts.loading.msg
.insertAfter(opts.loading.selector)
.show(opts.loading.speed, $.proxy(function(){
this.beginAjax(opts);
}, self));
};
opts.loading.finished=opts.loading.finished||function(){
if(!opts.state.isBeyondMaxPage)
opts.loading.msg.fadeOut(opts.loading.speed);
};
opts.callback=function(instance, data, url){
if(!!opts.behavior&&instance['_callback_'+opts.behavior]!==undefined){
instance['_callback_'+opts.behavior].call($(opts.contentSelector)[0], data, url);
}
if(callback){
callback.call($(opts.contentSelector)[0], data, opts, url);
}
if(opts.prefill){
$window.bind('resize.infinite-scroll', instance._prefill);
}};
if(options.debug){
if(Function.prototype.bind&&(typeof console==='object'||typeof console==='function')&&typeof console.log==='object'){
['log','info','warn','error','assert','dir','clear','profile','profileEnd']
.forEach(function (method){
console[method]=this.call(console[method], console);
}, Function.prototype.bind);
}}
this._setup();
if(opts.prefill){
this._prefill();
}
return true;
},
_prefill: function infscr_prefill(){
var instance=this;
var $window=$(window);
function needsPrefill(){
return($(instance.options.contentSelector).height() <=$window.height());
}
this._prefill=function(){
if(needsPrefill()){
instance.scroll();
}
$window.bind('resize.infinite-scroll', function(){
if(needsPrefill()){
$window.unbind('resize.infinite-scroll');
instance.scroll();
}});
};
this._prefill();
},
_debug: function infscr_debug(){
if(true!==this.options.debug){
return;
}
if(typeof console!=='undefined'&&typeof console.log==='function'){
if((Array.prototype.slice.call(arguments)).length===1&&typeof Array.prototype.slice.call(arguments)[0]==='string'){
console.log((Array.prototype.slice.call(arguments)).toString());
}else{
console.log(Array.prototype.slice.call(arguments));
}}else if(!Function.prototype.bind&&typeof console!=='undefined'&&typeof console.log==='object'){
Function.prototype.call.call(console.log, console, Array.prototype.slice.call(arguments));
}},
_determinepath: function infscr_determinepath(path){
var opts=this.options;
if(!!opts.behavior&&this['_determinepath_'+opts.behavior]!==undefined){
return this['_determinepath_'+opts.behavior].call(this,path);
}
if(!!opts.pathParse){
this._debug('pathParse manual');
return opts.pathParse(path, this.options.state.currPage+1);
}else if(path.match(/^(.*2?)\b2\b(.*?$)/)){
path=path.match(/^(.*2?)\b2\b(.*?$)/).slice(1);
}else if(path.match(/^(.*?)\b2\b(.*?$)/)){
path=path.match(/^(.*?)\b2\b(.*?$)/).slice(1);
}else if(path.match(/^(.*?)2(.*?$)/)){
if(path.match(/^(.*?page=)2(\/.*|$)/)){
path=path.match(/^(.*?page=)2(\/.*|$)/).slice(1);
return path;
}
path=path.match(/^(.*?)2(.*?$)/).slice(1);
}else{
if(path.match(/^(.*?page=)1(\/.*|$)/)){
path=path.match(/^(.*?page=)1(\/.*|$)/).slice(1);
return path;
}else{
this._debug("Sorry, we couldn't parse your Next (Previous Posts) URL. Verify your the css selector points to the correct A tag. If you still get this error: yell, scream, and kindly ask for help at infinite-scroll.com.");
opts.state.isInvalidPage=true;
}}
this._debug('determinePath', path);
return path;
},
_error: function infscr_error(xhr){
var opts=this.options;
if(!!opts.behavior&&this['_error_'+opts.behavior]!==undefined){
this['_error_'+opts.behavior].call(this,xhr);
return;
}
if(xhr!=='destroy'&&xhr!=='end'){
xhr='unknown';
}
this._debug('Error', xhr);
if(xhr==='end'||opts.state.isBeyondMaxPage){
this._showdonemsg();
}
opts.state.isDone=true;
opts.state.currPage=1;
opts.state.isPaused=false;
opts.state.isBeyondMaxPage=false;
this._binding('unbind');
},
_loadcallback: function infscr_loadcallback(box, data, url){
var opts=this.options,
callback=this.options.callback,
result=(opts.state.isDone) ? 'done':(!opts.appendCallback) ? 'no-append':'append',
frag;
if(!!opts.behavior&&this['_loadcallback_'+opts.behavior]!==undefined){
this['_loadcallback_'+opts.behavior].call(this,box,data,url);
return;
}
switch (result){
case 'done':
this._showdonemsg();
return false;
case 'no-append':
if(opts.dataType==='html'){
data='' + data + '
';
data=$(data).find(opts.itemSelector);
}
if(data.length===0){
return this._error('end');
}
break;
case 'append':
var children=box.children();
if(children.length===0){
return this._error('end');
}
frag=document.createDocumentFragment();
while (box[0].firstChild){
frag.appendChild(box[0].firstChild);
}
this._debug('contentSelector', $(opts.contentSelector)[0]);
$(opts.contentSelector)[0].appendChild(frag);
data=children.get();
break;
}
opts.loading.finished.call($(opts.contentSelector)[0],opts);
if(opts.animate){
var scrollTo=$(window).scrollTop() + $(opts.loading.msg).height() + opts.extraScrollPx + 'px';
$('html,body').animate({ scrollTop: scrollTo }, 800, function (){ opts.state.isDuringAjax=false; });
}
if(!opts.animate){
opts.state.isDuringAjax=false;
}
callback(this, data, url);
if(opts.prefill){
this._prefill();
}},
_nearbottom: function infscr_nearbottom(){
var opts=this.options,
pixelsFromWindowBottomToBottom=0 + $(document).height() - (opts.binder.scrollTop()) - $(window).height();
if(!!opts.behavior&&this['_nearbottom_'+opts.behavior]!==undefined){
return this['_nearbottom_'+opts.behavior].call(this);
}
this._debug('math:', pixelsFromWindowBottomToBottom, opts.pixelsFromNavToBottom);
return (pixelsFromWindowBottomToBottom - opts.bufferPx < opts.pixelsFromNavToBottom);
},
_pausing: function infscr_pausing(pause){
var opts=this.options;
if(!!opts.behavior&&this['_pausing_'+opts.behavior]!==undefined){
this['_pausing_'+opts.behavior].call(this,pause);
return;
}
if(pause!=='pause'&&pause!=='resume'&&pause!==null){
this._debug('Invalid argument. Toggling pause value instead');
}
pause=(pause&&(pause==='pause'||pause==='resume')) ? pause:'toggle';
switch (pause){
case 'pause':
opts.state.isPaused=true;
break;
case 'resume':
opts.state.isPaused=false;
break;
case 'toggle':
opts.state.isPaused = !opts.state.isPaused;
break;
}
this._debug('Paused', opts.state.isPaused);
return false;
},
_setup: function infscr_setup(){
var opts=this.options;
if(!!opts.behavior&&this['_setup_'+opts.behavior]!==undefined){
this['_setup_'+opts.behavior].call(this);
return;
}
this._binding('bind');
return false;
},
_showdonemsg: function infscr_showdonemsg(){
var opts=this.options;
if(!!opts.behavior&&this['_showdonemsg_'+opts.behavior]!==undefined){
this['_showdonemsg_'+opts.behavior].call(this);
return;
}
opts.loading.msg
.find('.fusion-loading-spinner')
.hide()
.parent()
.find('.fusion-loading-msg').html(opts.loading.finishedMsg).animate({ opacity: 1 }, 2000, function (){
$(this).parent().fadeOut(opts.loading.speed);
$('.fusion-load-more-button').fadeOut(opts.loading.speed);
});
opts.errorCallback.call($(opts.contentSelector)[0],'done');
},
_validate: function infscr_validate(opts){
for (var key in opts){
if(key.indexOf&&key.indexOf('Selector') > -1&&$(opts[key]).length===0){
this._debug('Your ' + key + ' found no elements.');
return false;
}}
return true;
},
bind: function infscr_bind(){
this._binding('bind');
},
destroy: function infscr_destroy(){
this.options.state.isDestroyed=true;
this.options.loading.finished();
return this._error('destroy');
},
pause: function infscr_pause(){
this._pausing('pause');
},
resume: function infscr_resume(){
this._pausing('resume');
},
beginAjax: function infscr_ajax(opts){
var instance=this,
path=opts.path,
box, desturl, method, condition;
opts.state.currPage++;
if(opts.maxPage!==undefined&&opts.state.currPage > opts.maxPage){
opts.state.isBeyondMaxPage=true;
this.destroy();
return;
}
box=$(opts.contentSelector).is('table, tbody') ? $(''):$('');
desturl=(typeof path==='function') ? path(opts.state.currPage):path.join(opts.state.currPage);
instance._debug('heading into ajax', desturl);
method=(opts.dataType==='html'||opts.dataType==='json') ? opts.dataType:'html+callback';
if(opts.appendCallback&&opts.dataType==='html'){
method +='+callback';
}
switch (method){
case 'html+callback':
instance._debug('Using HTML via .load() method');
box.load(desturl + ' ' + opts.itemSelector, undefined, function infscr_ajax_callback(responseText){
instance._loadcallback(box, responseText, desturl);
});
break;
case 'html':
instance._debug('Using ' + (method.toUpperCase()) + ' via $.ajax() method');
$.ajax({
url: desturl,
dataType: opts.dataType,
complete: function infscr_ajax_callback(jqXHR, textStatus){
condition=(typeof (jqXHR.isResolved)!=='undefined') ? (jqXHR.isResolved()):(textStatus==='success'||textStatus==='notmodified');
if(condition){
instance._loadcallback(box, jqXHR.responseText, desturl);
}else{
instance._error('end');
}}
});
break;
case 'json':
instance._debug('Using ' + (method.toUpperCase()) + ' via $.ajax() method');
$.ajax({
dataType: 'json',
type: 'GET',
url: desturl,
success: function (data, textStatus, jqXHR){
condition=(typeof (jqXHR.isResolved)!=='undefined') ? (jqXHR.isResolved()):(textStatus==='success'||textStatus==='notmodified');
if(opts.appendCallback){
if(opts.template!==undefined){
var theData=opts.template(data);
box.append(theData);
if(condition){
instance._loadcallback(box, theData);
}else{
instance._error('end');
}}else{
instance._debug('template must be defined.');
instance._error('end');
}}else{
if(condition){
instance._loadcallback(box, data, desturl);
}else{
instance._error('end');
}}
},
error: function(){
instance._debug('JSON ajax request failed.');
instance._error('end');
}});
break;
}},
retrieve: function infscr_retrieve(pageNum){
pageNum=pageNum||null;
var instance=this,
opts=instance.options;
if(!!opts.behavior&&this['retrieve_'+opts.behavior]!==undefined){
this['retrieve_'+opts.behavior].call(this,pageNum);
return;
}
if(opts.state.isDestroyed){
this._debug('Instance is destroyed');
return false;
}
opts.state.isDuringAjax=true;
opts.loading.start.call($(opts.contentSelector)[0],opts);
},
scroll: function infscr_scroll(){
var opts=this.options,
state=opts.state;
if(!!opts.behavior&&this['scroll_'+opts.behavior]!==undefined){
this['scroll_'+opts.behavior].call(this);
return;
}
if(state.isDuringAjax||state.isInvalidPage||state.isDone||state.isDestroyed||state.isPaused){
return;
}
if(!this._nearbottom()){
return;
}
this.retrieve();
},
toggle: function infscr_toggle(){
this._pausing();
},
unbind: function infscr_unbind(){
this._binding('unbind');
},
update: function infscr_options(key){
if($.isPlainObject(key)){
this.options=$.extend(true,this.options,key);
}}
};
$.fn.infinitescroll=function infscr_init(options, callback){
var thisCall=typeof options;
switch (thisCall){
case 'string':
var args=Array.prototype.slice.call(arguments, 1);
this.each(function (){
var instance=$.data(this, 'infinitescroll');
if(!instance){
return false;
}
if(!$.isFunction(instance[options])||options.charAt(0)==='_'){
return false;
}
instance[options].apply(instance, args);
});
break;
case 'object':
this.each(function (){
var instance=$.data(this, 'infinitescroll');
if(instance){
instance.update(options);
}else{
instance=new $.infinitescroll(options, callback, this);
if(!instance.failed){
$.data(this, 'infinitescroll', instance);
}}
});
break;
}
return this;
};
var event=$.event,
scrollTimeout;
event.special.smartscroll={
setup: function (){
$(this).bind('scroll', event.special.smartscroll.handler);
},
teardown: function (){
$(this).unbind('scroll', event.special.smartscroll.handler);
},
handler: function (event, execAsap){
var context=this,
args=arguments;
event.type='smartscroll';
if(scrollTimeout){ clearTimeout(scrollTimeout); }
scrollTimeout=setTimeout(function (){
$(context).trigger('smartscroll', args);
}, execAsap==='execAsap' ? 0:100);
}};
$.fn.smartscroll=function (fn){
return fn ? this.bind('smartscroll', fn):this.trigger('smartscroll', ['execAsap']);
};}));
(function(window){
var slice=Array.prototype.slice;
function noop(){}
function defineBridget($){
if(!$){
return;
}
function addOptionMethod(PluginClass){
if(PluginClass.prototype.option){
return;
}
PluginClass.prototype.option=function(opts){
if(!$.isPlainObject(opts)){
return;
}
this.options=$.extend(true, this.options, opts);
};}
var logError=typeof console==='undefined' ? noop :
function(message){
console.error(message);
};
function bridge(namespace, PluginClass){
$.fn[ namespace ]=function(options){
if(typeof options==='string'){
var args=slice.call(arguments, 1);
for(var i=0, len=this.length; i < len; i++){
var elem=this[i];
var instance=$.data(elem, namespace);
if(!instance){
logError("cannot call methods on " + namespace + " prior to initialization; " +
"attempted to call '" + options + "'");
continue;
}
if(!$.isFunction(instance[options])||options.charAt(0)==='_'){
logError("no such method '" + options + "' for " + namespace + " instance");
continue;
}
var returnValue=instance[ options ].apply(instance, args);
if(returnValue!==undefined){
return returnValue;
}}
return this;
}else{
return this.each(function(){
var instance=$.data(this, namespace);
if(instance){
instance.option(options);
instance._init();
}else{
instance=new PluginClass(this, options);
$.data(this, namespace, instance);
}});
}};}
$.bridget=function(namespace, PluginClass){
addOptionMethod(PluginClass);
bridge(namespace, PluginClass);
};
return $.bridget;
}
if(typeof define==='function'&&define.amd){
define('jquery-bridget/jquery.bridget',[ 'jquery' ], defineBridget);
}else if(typeof exports==='object'){
defineBridget(require('jquery'));
}else{
defineBridget(window.jQuery);
}})(window);
(function(window){
var docElem=document.documentElement;
var bind=function(){};
function getIEEvent(obj){
var event=window.event;
event.target=event.target||event.srcElement||obj;
return event;
}
if(docElem.addEventListener){
bind=function(obj, type, fn){
obj.addEventListener(type, fn, false);
};}else if(docElem.attachEvent){
bind=function(obj, type, fn){
obj[ type + fn ]=fn.handleEvent ?
function(){
var event=getIEEvent(obj);
fn.handleEvent.call(fn, event);
} :
function(){
var event=getIEEvent(obj);
fn.call(obj, event);
};
obj.attachEvent("on" + type, obj[ type + fn ]);
};}
var unbind=function(){};
if(docElem.removeEventListener){
unbind=function(obj, type, fn){
obj.removeEventListener(type, fn, false);
};}else if(docElem.detachEvent){
unbind=function(obj, type, fn){
obj.detachEvent("on" + type, obj[ type + fn ]);
try {
delete obj[ type + fn ];
} catch(err){
obj[ type + fn ]=undefined;
}};}
var eventie={
bind: bind,
unbind: unbind
};
if(typeof define==='function'&&define.amd){
define('eventie/eventie',eventie);
}else if(typeof exports==='object'){
module.exports=eventie;
}else{
window.eventie=eventie;
}})(this);
(function(window){
var document=window.document;
var queue=[];
function docReady(fn){
if(typeof fn!=='function'){
return;
}
if(docReady.isReady){
fn();
}else{
queue.push(fn);
}}
docReady.isReady=false;
function onReady(event){
var isIE8NotReady=event.type==='readystatechange'&&document.readyState!=='complete';
if(docReady.isReady||isIE8NotReady){
return;
}
trigger();
}
function trigger(){
docReady.isReady=true;
for(var i=0, len=queue.length; i < len; i++){
var fn=queue[i];
fn();
}}
function defineDocReady(eventie){
if(document.readyState==='complete'){
trigger();
}else{
eventie.bind(document, 'DOMContentLoaded', onReady);
eventie.bind(document, 'readystatechange', onReady);
eventie.bind(window, 'load', onReady);
}
return docReady;
}
if(typeof define==='function'&&define.amd){
define('doc-ready/doc-ready',[ 'eventie/eventie' ], defineDocReady);
}else if(typeof exports==='object'){
module.exports=defineDocReady(require('eventie'));
}else{
window.docReady=defineDocReady(window.eventie);
}})(window);
(function (){
function EventEmitter(){}
var proto=EventEmitter.prototype;
var exports=this;
var originalGlobalValue=exports.EventEmitter;
function indexOfListener(listeners, listener){
var i=listeners.length;
while (i--){
if(listeners[i].listener===listener){
return i;
}}
return -1;
}
function alias(name){
return function aliasClosure(){
return this[name].apply(this, arguments);
};}
proto.getListeners=function getListeners(evt){
var events=this._getEvents();
var response;
var key;
if(evt instanceof RegExp){
response={};
for (key in events){
if(events.hasOwnProperty(key)&&evt.test(key)){
response[key]=events[key];
}}
}else{
response=events[evt]||(events[evt]=[]);
}
return response;
};
proto.flattenListeners=function flattenListeners(listeners){
var flatListeners=[];
var i;
for (i=0; i < listeners.length; i +=1){
flatListeners.push(listeners[i].listener);
}
return flatListeners;
};
proto.getListenersAsObject=function getListenersAsObject(evt){
var listeners=this.getListeners(evt);
var response;
if(listeners instanceof Array){
response={};
response[evt]=listeners;
}
return response||listeners;
};
proto.addListener=function addListener(evt, listener){
var listeners=this.getListenersAsObject(evt);
var listenerIsWrapped=typeof listener==='object';
var key;
for (key in listeners){
if(listeners.hasOwnProperty(key)&&indexOfListener(listeners[key], listener)===-1){
listeners[key].push(listenerIsWrapped ? listener:{
listener: listener,
once: false
});
}}
return this;
};
proto.on=alias('addListener');
proto.addOnceListener=function addOnceListener(evt, listener){
return this.addListener(evt, {
listener: listener,
once: true
});
};
proto.once=alias('addOnceListener');
proto.defineEvent=function defineEvent(evt){
this.getListeners(evt);
return this;
};
proto.defineEvents=function defineEvents(evts){
for (var i=0; i < evts.length; i +=1){
this.defineEvent(evts[i]);
}
return this;
};
proto.removeListener=function removeListener(evt, listener){
var listeners=this.getListenersAsObject(evt);
var index;
var key;
for (key in listeners){
if(listeners.hasOwnProperty(key)){
index=indexOfListener(listeners[key], listener);
if(index!==-1){
listeners[key].splice(index, 1);
}}
}
return this;
};
proto.off=alias('removeListener');
proto.addListeners=function addListeners(evt, listeners){
return this.manipulateListeners(false, evt, listeners);
};
proto.removeListeners=function removeListeners(evt, listeners){
return this.manipulateListeners(true, evt, listeners);
};
proto.manipulateListeners=function manipulateListeners(remove, evt, listeners){
var i;
var value;
var single=remove ? this.removeListener:this.addListener;
var multiple=remove ? this.removeListeners:this.addListeners;
if(typeof evt==='object'&&!(evt instanceof RegExp)){
for (i in evt){
if(evt.hasOwnProperty(i)&&(value=evt[i])){
if(typeof value==='function'){
single.call(this, i, value);
}else{
multiple.call(this, i, value);
}}
}}else{
i=listeners.length;
while (i--){
single.call(this, evt, listeners[i]);
}}
return this;
};
proto.removeEvent=function removeEvent(evt){
var type=typeof evt;
var events=this._getEvents();
var key;
if(type==='string'){
delete events[evt];
}
else if(evt instanceof RegExp){
for (key in events){
if(events.hasOwnProperty(key)&&evt.test(key)){
delete events[key];
}}
}else{
delete this._events;
}
return this;
};
proto.removeAllListeners=alias('removeEvent');
proto.emitEvent=function emitEvent(evt, args){
var listeners=this.getListenersAsObject(evt);
var listener;
var i;
var key;
var response;
for (key in listeners){
if(listeners.hasOwnProperty(key)){
i=listeners[key].length;
while (i--){
listener=listeners[key][i];
if(listener.once===true){
this.removeListener(evt, listener.listener);
}
response=listener.listener.apply(this, args||[]);
if(response===this._getOnceReturnValue()){
this.removeListener(evt, listener.listener);
}}
}}
return this;
};
proto.trigger=alias('emitEvent');
proto.emit=function emit(evt){
var args=Array.prototype.slice.call(arguments, 1);
return this.emitEvent(evt, args);
};
proto.setOnceReturnValue=function setOnceReturnValue(value){
this._onceReturnValue=value;
return this;
};
proto._getOnceReturnValue=function _getOnceReturnValue(){
if(this.hasOwnProperty('_onceReturnValue')){
return this._onceReturnValue;
}else{
return true;
}};
proto._getEvents=function _getEvents(){
return this._events||(this._events={});
};
EventEmitter.noConflict=function noConflict(){
exports.EventEmitter=originalGlobalValue;
return EventEmitter;
};
if(typeof define==='function'&&define.amd){
define('eventEmitter/EventEmitter',[],function (){
return EventEmitter;
});
}
else if(typeof module==='object'&&module.exports){
module.exports=EventEmitter;
}else{
exports.EventEmitter=EventEmitter;
}}.call(this));
(function(window){
var prefixes='Webkit Moz ms Ms O'.split(' ');
var docElemStyle=document.documentElement.style;
function getStyleProperty(propName){
if(!propName){
return;
}
if(typeof docElemStyle[ propName ]==='string'){
return propName;
}
propName=propName.charAt(0).toUpperCase() + propName.slice(1);
var prefixed;
for(var i=0, len=prefixes.length; i < len; i++){
prefixed=prefixes[i] + propName;
if(typeof docElemStyle[ prefixed ]==='string'){
return prefixed;
}}
}
if(typeof define==='function'&&define.amd){
define('get-style-property/get-style-property',[],function(){
return getStyleProperty;
});
}else if(typeof exports==='object'){
module.exports=getStyleProperty;
}else{
window.getStyleProperty=getStyleProperty;
}})(window);
(function(window, undefined){
function getStyleSize(value){
var num=parseFloat(value);
var isValid=value.indexOf('%')===-1&&!isNaN(num);
return isValid&#
}
function noop(){}
var logError=typeof console==='undefined' ? noop :
function(message){
console.error(message);
};
var measurements=[
'paddingLeft',
'paddingRight',
'paddingTop',
'paddingBottom',
'marginLeft',
'marginRight',
'marginTop',
'marginBottom',
'borderLeftWidth',
'borderRightWidth',
'borderTopWidth',
'borderBottomWidth'
];
function getZeroSize(){
var size={
width: 0,
height: 0,
innerWidth: 0,
innerHeight: 0,
outerWidth: 0,
outerHeight: 0
};
for(var i=0, len=measurements.length; i < len; i++){
var measurement=measurements[i];
size[ measurement ]=0;
}
return size;
}
function defineGetSize(getStyleProperty){
var isSetup=false;
var getStyle, boxSizingProp, isBoxSizeOuter;
function setup(){
if(isSetup){
return;
}
isSetup=true;
var getComputedStyle=window.getComputedStyle;
getStyle=(function(){
var getStyleFn=getComputedStyle ?
function(elem){
return getComputedStyle(elem, null);
} :
function(elem){
return elem.currentStyle;
};
return function getStyle(elem){
var style=getStyleFn(elem);
if(!style){
logError('Style returned ' + style +
'. Are you running this code in a hidden iframe on Firefox? ' +
'See http://bit.ly/getsizebug1');
}
return style;
};})();
boxSizingProp=getStyleProperty('boxSizing');
if(boxSizingProp){
var div=document.createElement('div');
div.style.width='200px';
div.style.padding='1px 2px 3px 4px';
div.style.borderStyle='solid';
div.style.borderWidth='1px 2px 3px 4px';
div.style[ boxSizingProp ]='border-box';
var body=document.body||document.documentElement;
body.appendChild(div);
var style=getStyle(div);
isBoxSizeOuter=getStyleSize(style.width)===200;
body.removeChild(div);
}}
function getSize(elem){
setup();
if(typeof elem==='string'){
elem=document.querySelector(elem);
}
if(!elem||typeof elem!=='object'||!elem.nodeType){
return;
}
var style=getStyle(elem);
if(style.display==='none'){
return getZeroSize();
}
var size={};
size.width=elem.offsetWidth;
size.height=elem.offsetHeight;
var isBorderBox=size.isBorderBox = !!(boxSizingProp &&
style[ boxSizingProp ]&&style[ boxSizingProp ]==='border-box');
for(var i=0, len=measurements.length; i < len; i++){
var measurement=measurements[i];
var value=style[ measurement ];
value=mungeNonPixel(elem, value);
var num=parseFloat(value);
size[ measurement ] = !isNaN(num) ? num:0;
}
var paddingWidth=size.paddingLeft + size.paddingRight;
var paddingHeight=size.paddingTop + size.paddingBottom;
var marginWidth=size.marginLeft + size.marginRight;
var marginHeight=size.marginTop + size.marginBottom;
var borderWidth=size.borderLeftWidth + size.borderRightWidth;
var borderHeight=size.borderTopWidth + size.borderBottomWidth;
var isBorderBoxSizeOuter=isBorderBox&&isBoxSizeOuter;
var styleWidth=getStyleSize(style.width);
if(styleWidth!==false){
size.width=styleWidth +
(isBorderBoxSizeOuter ? 0:paddingWidth + borderWidth);
}
var styleHeight=getStyleSize(style.height);
if(styleHeight!==false){
size.height=styleHeight +
(isBorderBoxSizeOuter ? 0:paddingHeight + borderHeight);
}
size.innerWidth=size.width -(paddingWidth + borderWidth);
size.innerHeight=size.height -(paddingHeight + borderHeight);
size.outerWidth=size.width + marginWidth;
size.outerHeight=size.height + marginHeight;
return size;
}
function mungeNonPixel(elem, value){
if(window.getComputedStyle||value.indexOf('%')===-1){
return value;
}
var style=elem.style;
var left=style.left;
var rs=elem.runtimeStyle;
var rsLeft=rs&&rs.left;
if(rsLeft){
rs.left=elem.currentStyle.left;
}
style.left=value;
value=style.pixelLeft;
style.left=left;
if(rsLeft){
rs.left=rsLeft;
}
return value;
}
return getSize;
}
if(typeof define==='function'&&define.amd){
define('get-size/get-size',[ 'get-style-property/get-style-property' ], defineGetSize);
}else if(typeof exports==='object'){
module.exports=defineGetSize(require('desandro-get-style-property'));
}else{
window.getSize=defineGetSize(window.getStyleProperty);
}})(window);
(function(ElemProto){
var matchesMethod=(function(){
if(ElemProto.matchesSelector){
return 'matchesSelector';
}
var prefixes=[ 'webkit', 'moz', 'ms', 'o' ];
for(var i=0, len=prefixes.length; i < len; i++){
var prefix=prefixes[i];
var method=prefix + 'MatchesSelector';
if(ElemProto[ method ]){
return method;
}}
})();
function match(elem, selector){
return elem[ matchesMethod ](selector);
}
function checkParent(elem){
if(elem.parentNode){
return;
}
var fragment=document.createDocumentFragment();
fragment.appendChild(elem);
}
function query(elem, selector){
checkParent(elem);
var elems=elem.parentNode.querySelectorAll(selector);
for(var i=0, len=elems.length; i < len; i++){
if(elems[i]===elem){
return true;
}}
return false;
}
function matchChild(elem, selector){
checkParent(elem);
return match(elem, selector);
}
var matchesSelector;
if(matchesMethod){
var div=document.createElement('div');
var supportsOrphans=match(div, 'div');
matchesSelector=supportsOrphans ? match:matchChild;
}else{
matchesSelector=query;
}
if(typeof define==='function'&&define.amd){
define('matches-selector/matches-selector',[],function(){
return matchesSelector;
});
}else if(typeof exports==='object'){
module.exports=matchesSelector;
}else{
window.matchesSelector=matchesSelector;
}})(Element.prototype);
(function(window){
var getComputedStyle=window.getComputedStyle;
var getStyle=getComputedStyle ?
function(elem){
return getComputedStyle(elem, null);
} :
function(elem){
return elem.currentStyle;
};
function extend(a, b){
for(var prop in b){
a[ prop ]=b[ prop ];
}
return a;
}
function isEmptyObj(obj){
for(var prop in obj){
return false;
}
prop=null;
return true;
}
function toDash(str){
return str.replace(/([A-Z])/g, function($1){
return '-' + $1.toLowerCase();
});
}
function outlayerItemDefinition(EventEmitter, getSize, getStyleProperty){
var transitionProperty=getStyleProperty('transition');
var transformProperty=getStyleProperty('transform');
var supportsCSS3=transitionProperty&&transformProperty;
var is3d = !!getStyleProperty('perspective');
var transitionEndEvent={
WebkitTransition: 'webkitTransitionEnd',
MozTransition: 'transitionend',
OTransition: 'otransitionend',
transition: 'transitionend'
}[ transitionProperty ];
var prefixableProperties=[
'transform',
'transition',
'transitionDuration',
'transitionProperty'
];
var vendorProperties=(function(){
var cache={};
for(var i=0, len=prefixableProperties.length; i < len; i++){
var prop=prefixableProperties[i];
var supportedProp=getStyleProperty(prop);
if(supportedProp&&supportedProp!==prop){
cache[ prop ]=supportedProp;
}}
return cache;
})();
function Item(element, layout){
if(!element){
return;
}
this.element=element;
this.layout=layout;
this.position={
x: 0,
y: 0
};
this._create();
}
extend(Item.prototype, EventEmitter.prototype);
Item.prototype._create=function(){
this._transn={
ingProperties: {},
clean: {},
onEnd: {}};
this.css({
position: 'absolute'
});
};
Item.prototype.handleEvent=function(event){
var method='on' + event.type;
if(this[ method ]){
this[ method ](event);
}};
Item.prototype.getSize=function(){
this.size=getSize(this.element);
};
Item.prototype.css=function(style){
var elemStyle=this.element.style;
for(var prop in style){
var supportedProp=vendorProperties[ prop ]||prop;
elemStyle[ supportedProp ]=style[ prop ];
}};
Item.prototype.getPosition=function(){
var style=getStyle(this.element);
var layoutOptions=this.layout.options;
var isOriginLeft=layoutOptions.isOriginLeft;
var isOriginTop=layoutOptions.isOriginTop;
var x=parseInt(style[ isOriginLeft ? 'left':'right' ], 10);
var y=parseInt(style[ isOriginTop ? 'top':'bottom' ], 10);
x=isNaN(x) ? 0:x;
y=isNaN(y) ? 0:y;
var layoutSize=this.layout.size;
x -=isOriginLeft ? layoutSize.paddingLeft:layoutSize.paddingRight;
y -=isOriginTop ? layoutSize.paddingTop:layoutSize.paddingBottom;
this.position.x=x;
this.position.y=y;
};
Item.prototype.layoutPosition=function(){
var layoutSize=this.layout.size;
var layoutOptions=this.layout.options;
var style={};
if(layoutOptions.isOriginLeft){
style.left=(this.position.x + layoutSize.paddingLeft) + 'px';
style.right='';
}else{
style.right=(this.position.x + layoutSize.paddingRight) + 'px';
style.left='';
}
if(layoutOptions.isOriginTop){
style.top=(this.position.y + layoutSize.paddingTop) + 'px';
style.bottom='';
}else{
style.bottom=(this.position.y + layoutSize.paddingBottom) + 'px';
style.top='';
}
this.css(style);
this.emitEvent('layout', [ this ]);
};
var translate=is3d ?
function(x, y){
return 'translate3d(' + x + 'px, ' + y + 'px, 0)';
} :
function(x, y){
return 'translate(' + x + 'px, ' + y + 'px)';
};
Item.prototype._transitionTo=function(x, y){
this.getPosition();
var curX=this.position.x;
var curY=this.position.y;
var compareX=parseInt(x, 10);
var compareY=parseInt(y, 10);
var didNotMove=compareX===this.position.x&&compareY===this.position.y;
this.setPosition(x, y);
if(didNotMove&&!this.isTransitioning){
this.layoutPosition();
return;
}
var transX=x - curX;
var transY=y - curY;
var transitionStyle={};
var layoutOptions=this.layout.options;
transX=layoutOptions.isOriginLeft ? transX:-transX;
transY=layoutOptions.isOriginTop ? transY:-transY;
transitionStyle.transform=translate(transX, transY);
this.transition({
to: transitionStyle,
onTransitionEnd: {
transform: this.layoutPosition
},
isCleaning: true
});
};
Item.prototype.goTo=function(x, y){
this.setPosition(x, y);
this.layoutPosition();
};
Item.prototype.moveTo=supportsCSS3 ?
Item.prototype._transitionTo:Item.prototype.goTo;
Item.prototype.setPosition=function(x, y){
this.position.x=parseInt(x, 10);
this.position.y=parseInt(y, 10);
};
Item.prototype._nonTransition=function(args){
this.css(args.to);
if(args.isCleaning){
this._removeStyles(args.to);
}
for(var prop in args.onTransitionEnd){
args.onTransitionEnd[ prop ].call(this);
}};
Item.prototype._transition=function(args){
if(!parseFloat(this.layout.options.transitionDuration)){
this._nonTransition(args);
return;
}
var _transition=this._transn;
for(var prop in args.onTransitionEnd){
_transition.onEnd[ prop ]=args.onTransitionEnd[ prop ];
}
for(prop in args.to){
_transition.ingProperties[ prop ]=true;
if(args.isCleaning){
_transition.clean[ prop ]=true;
}}
if(args.from){
this.css(args.from);
var h=this.element.offsetHeight;
h=null;
}
this.enableTransition(args.to);
this.css(args.to);
this.isTransitioning=true;
};
var itemTransitionProperties=transformProperty&&(toDash(transformProperty) +
',opacity');
Item.prototype.enableTransition=function(){
if(this.isTransitioning){
return;
}
this.css({
transitionProperty: itemTransitionProperties,
transitionDuration: this.layout.options.transitionDuration
});
this.element.addEventListener(transitionEndEvent, this, false);
};
Item.prototype.transition=Item.prototype[ transitionProperty ? '_transition':'_nonTransition' ];
Item.prototype.onwebkitTransitionEnd=function(event){
this.ontransitionend(event);
};
Item.prototype.onotransitionend=function(event){
this.ontransitionend(event);
};
var dashedVendorProperties={
'-webkit-transform': 'transform',
'-moz-transform': 'transform',
'-o-transform': 'transform'
};
Item.prototype.ontransitionend=function(event){
if(event.target!==this.element){
return;
}
var _transition=this._transn;
var propertyName=dashedVendorProperties[ event.propertyName ]||event.propertyName;
delete _transition.ingProperties[ propertyName ];
if(isEmptyObj(_transition.ingProperties)){
this.disableTransition();
}
if(propertyName in _transition.clean){
this.element.style[ event.propertyName ]='';
delete _transition.clean[ propertyName ];
}
if(propertyName in _transition.onEnd){
var onTransitionEnd=_transition.onEnd[ propertyName ];
onTransitionEnd.call(this);
delete _transition.onEnd[ propertyName ];
}
this.emitEvent('transitionEnd', [ this ]);
};
Item.prototype.disableTransition=function(){
this.removeTransitionStyles();
this.element.removeEventListener(transitionEndEvent, this, false);
this.isTransitioning=false;
};
Item.prototype._removeStyles=function(style){
var cleanStyle={};
for(var prop in style){
cleanStyle[ prop ]='';
}
this.css(cleanStyle);
};
var cleanTransitionStyle={
transitionProperty: '',
transitionDuration: ''
};
Item.prototype.removeTransitionStyles=function(){
this.css(cleanTransitionStyle);
};
Item.prototype.removeElem=function(){
this.element.parentNode.removeChild(this.element);
this.emitEvent('remove', [ this ]);
};
Item.prototype.remove=function(){
if(!transitionProperty||!parseFloat(this.layout.options.transitionDuration)){
this.removeElem();
return;
}
var _this=this;
this.on('transitionEnd', function(){
_this.removeElem();
return true;
});
this.hide();
};
Item.prototype.reveal=function(){
delete this.isHidden;
this.css({ display: '' });
var options=this.layout.options;
this.transition({
from: options.hiddenStyle,
to: options.visibleStyle,
isCleaning: true
});
};
Item.prototype.hide=function(){
this.isHidden=true;
this.css({ display: '' });
var options=this.layout.options;
this.transition({
from: options.visibleStyle,
to: options.hiddenStyle,
isCleaning: true,
onTransitionEnd: {
opacity: function(){
if(this.isHidden){
this.css({ display: 'none' });
}}
}});
};
Item.prototype.destroy=function(){
this.css({
position: '',
left: '',
right: '',
top: '',
bottom: '',
transition: '',
transform: ''
});
};
return Item;
}
if(typeof define==='function'&&define.amd){
define('outlayer/item',[
'eventEmitter/EventEmitter',
'get-size/get-size',
'get-style-property/get-style-property'
],
outlayerItemDefinition);
}else if(typeof exports==='object'){
module.exports=outlayerItemDefinition(
require('wolfy87-eventemitter'),
require('get-size'),
require('desandro-get-style-property')
);
}else{
window.Outlayer={};
window.Outlayer.Item=outlayerItemDefinition(
window.EventEmitter,
window.getSize,
window.getStyleProperty
);
}})(window);
(function(window){
var document=window.document;
var console=window.console;
var jQuery=window.jQuery;
var noop=function(){};
function extend(a, b){
for(var prop in b){
a[ prop ]=b[ prop ];
}
return a;
}
var objToString=Object.prototype.toString;
function isArray(obj){
return objToString.call(obj)==='[object Array]';
}
function makeArray(obj){
var ary=[];
if(isArray(obj)){
ary=obj;
}else if(obj&&typeof obj.length==='number'){
for(var i=0, len=obj.length; i < len; i++){
ary.push(obj[i]);
}}else{
ary.push(obj);
}
return ary;
}
var isElement=(typeof HTMLElement==='function'||typeof HTMLElement==='object') ?
function isElementDOM2(obj){
return obj instanceof HTMLElement;
} :
function isElementQuirky(obj){
return obj&&typeof obj==='object' &&
obj.nodeType===1&&typeof obj.nodeName==='string';
};
var indexOf=Array.prototype.indexOf ? function(ary, obj){
return ary.indexOf(obj);
}:function(ary, obj){
for(var i=0, len=ary.length; i < len; i++){
if(ary[i]===obj){
return i;
}}
return -1;
};
function removeFrom(obj, ary){
var index=indexOf(ary, obj);
if(index!==-1){
ary.splice(index, 1);
}}
function toDashed(str){
return str.replace(/(.)([A-Z])/g, function(match, $1, $2){
return $1 + '-' + $2;
}).toLowerCase();
}
function outlayerDefinition(eventie, docReady, EventEmitter, getSize, matchesSelector, Item){
var GUID=0;
var instances={};
function Outlayer(element, options){
if(typeof element==='string'){
element=document.querySelector(element);
}
if(!element||!isElement(element)){
if(console){
console.error('Bad ' + this.constructor.namespace + ' element: ' + element);
}
return;
}
this.element=element;
this.options=extend({}, this.constructor.defaults);
this.option(options);
var id=++GUID;
this.element.outlayerGUID=id;
instances[ id ]=this;
this._create();
if(this.options.isInitLayout){
this.layout();
}}
Outlayer.namespace='outlayer';
Outlayer.Item=Item;
Outlayer.defaults={
containerStyle: {
position: 'relative'
},
isInitLayout: true,
isOriginLeft: true,
isOriginTop: true,
isResizeBound: true,
isResizingContainer: true,
transitionDuration: '0.4s',
hiddenStyle: {
opacity: 0,
transform: 'scale(0.001)'
},
visibleStyle: {
opacity: 1,
transform: 'scale(1)'
}};
extend(Outlayer.prototype, EventEmitter.prototype);
Outlayer.prototype.option=function(opts){
extend(this.options, opts);
};
Outlayer.prototype._create=function(){
this.reloadItems();
this.stamps=[];
this.stamp(this.options.stamp);
extend(this.element.style, this.options.containerStyle);
if(this.options.isResizeBound){
this.bindResize();
}};
Outlayer.prototype.reloadItems=function(){
this.items=this._itemize(this.element.children);
};
Outlayer.prototype._itemize=function(elems){
var itemElems=this._filterFindItemElements(elems);
var Item=this.constructor.Item;
var items=[];
for(var i=0, len=itemElems.length; i < len; i++){
var elem=itemElems[i];
var item=new Item(elem, this);
items.push(item);
}
return items;
};
Outlayer.prototype._filterFindItemElements=function(elems){
elems=makeArray(elems);
var itemSelector=this.options.itemSelector;
var itemElems=[];
for(var i=0, len=elems.length; i < len; i++){
var elem=elems[i];
if(!isElement(elem)){
continue;
}
if(itemSelector){
if(matchesSelector(elem, itemSelector)){
itemElems.push(elem);
}
var childElems=elem.querySelectorAll(itemSelector);
for(var j=0, jLen=childElems.length; j < jLen; j++){
itemElems.push(childElems[j]);
}}else{
itemElems.push(elem);
}}
return itemElems;
};
Outlayer.prototype.getItemElements=function(){
var elems=[];
for(var i=0, len=this.items.length; i < len; i++){
elems.push(this.items[i].element);
}
return elems;
};
Outlayer.prototype.layout=function(){
this._resetLayout();
this._manageStamps();
var isInstant=this.options.isLayoutInstant!==undefined ?
this.options.isLayoutInstant:!this._isLayoutInited;
this.layoutItems(this.items, isInstant);
this._isLayoutInited=true;
};
Outlayer.prototype._init=Outlayer.prototype.layout;
Outlayer.prototype._resetLayout=function(){
this.getSize();
};
Outlayer.prototype.getSize=function(){
this.size=getSize(this.element);
};
Outlayer.prototype._getMeasurement=function(measurement, size){
var option=this.options[ measurement ];
var elem;
if(!option){
this[ measurement ]=0;
}else{
if(typeof option==='string'){
elem=this.element.querySelector(option);
}else if(isElement(option)){
elem=option;
}
this[ measurement ]=elem ? getSize(elem)[ size ]:option;
}};
Outlayer.prototype.layoutItems=function(items, isInstant){
items=this._getItemsForLayout(items);
this._layoutItems(items, isInstant);
this._postLayout();
};
Outlayer.prototype._getItemsForLayout=function(items){
var layoutItems=[];
for(var i=0, len=items.length; i < len; i++){
var item=items[i];
if(!item.isIgnored){
layoutItems.push(item);
}}
return layoutItems;
};
Outlayer.prototype._layoutItems=function(items, isInstant){
var _this=this;
function onItemsLayout(){
_this.emitEvent('layoutComplete', [ _this, items ]);
}
if(!items||!items.length){
onItemsLayout();
return;
}
this._itemsOn(items, 'layout', onItemsLayout);
var queue=[];
for(var i=0, len=items.length; i < len; i++){
var item=items[i];
var position=this._getItemLayoutPosition(item);
position.item=item;
position.isInstant=isInstant||item.isLayoutInstant;
queue.push(position);
}
this._processLayoutQueue(queue);
};
Outlayer.prototype._getItemLayoutPosition=function(){
return {
x: 0,
y: 0
};};
Outlayer.prototype._processLayoutQueue=function(queue){
for(var i=0, len=queue.length; i < len; i++){
var obj=queue[i];
this._positionItem(obj.item, obj.x, obj.y, obj.isInstant);
}};
Outlayer.prototype._positionItem=function(item, x, y, isInstant){
if(isInstant){
item.goTo(x, y);
}else{
item.moveTo(x, y);
}};
Outlayer.prototype._postLayout=function(){
this.resizeContainer();
};
Outlayer.prototype.resizeContainer=function(){
if(!this.options.isResizingContainer){
return;
}
var size=this._getContainerSize();
if(size){
this._setContainerMeasure(size.width, true);
this._setContainerMeasure(size.height, false);
}};
Outlayer.prototype._getContainerSize=noop;
Outlayer.prototype._setContainerMeasure=function(measure, isWidth){
if(measure===undefined){
return;
}
var elemSize=this.size;
if(elemSize.isBorderBox){
measure +=isWidth ? elemSize.paddingLeft + elemSize.paddingRight +
elemSize.borderLeftWidth + elemSize.borderRightWidth :
elemSize.paddingBottom + elemSize.paddingTop +
elemSize.borderTopWidth + elemSize.borderBottomWidth;
}
measure=Math.max(measure, 0);
this.element.style[ isWidth ? 'width':'height' ]=measure + 'px';
};
Outlayer.prototype._itemsOn=function(items, eventName, callback){
var doneCount=0;
var count=items.length;
var _this=this;
function tick(){
doneCount++;
if(doneCount===count){
callback.call(_this);
}
return true;
}
for(var i=0, len=items.length; i < len; i++){
var item=items[i];
item.on(eventName, tick);
}};
Outlayer.prototype.ignore=function(elem){
var item=this.getItem(elem);
if(item){
item.isIgnored=true;
}};
Outlayer.prototype.unignore=function(elem){
var item=this.getItem(elem);
if(item){
delete item.isIgnored;
}};
Outlayer.prototype.stamp=function(elems){
elems=this._find(elems);
if(!elems){
return;
}
this.stamps=this.stamps.concat(elems);
for(var i=0, len=elems.length; i < len; i++){
var elem=elems[i];
this.ignore(elem);
}};
Outlayer.prototype.unstamp=function(elems){
elems=this._find(elems);
if(!elems){
return;
}
for(var i=0, len=elems.length; i < len; i++){
var elem=elems[i];
removeFrom(elem, this.stamps);
this.unignore(elem);
}};
Outlayer.prototype._find=function(elems){
if(!elems){
return;
}
if(typeof elems==='string'){
elems=this.element.querySelectorAll(elems);
}
elems=makeArray(elems);
return elems;
};
Outlayer.prototype._manageStamps=function(){
if(!this.stamps||!this.stamps.length){
return;
}
this._getBoundingRect();
for(var i=0, len=this.stamps.length; i < len; i++){
var stamp=this.stamps[i];
this._manageStamp(stamp);
}};
Outlayer.prototype._getBoundingRect=function(){
var boundingRect=this.element.getBoundingClientRect();
var size=this.size;
this._boundingRect={
left: boundingRect.left + size.paddingLeft + size.borderLeftWidth,
top: boundingRect.top + size.paddingTop + size.borderTopWidth,
right: boundingRect.right -(size.paddingRight + size.borderRightWidth),
bottom: boundingRect.bottom -(size.paddingBottom + size.borderBottomWidth)
};};
Outlayer.prototype._manageStamp=noop;
Outlayer.prototype._getElementOffset=function(elem){
var boundingRect=elem.getBoundingClientRect();
var thisRect=this._boundingRect;
var size=getSize(elem);
var offset={
left: boundingRect.left - thisRect.left - size.marginLeft,
top: boundingRect.top - thisRect.top - size.marginTop,
right: thisRect.right - boundingRect.right - size.marginRight,
bottom: thisRect.bottom - boundingRect.bottom - size.marginBottom
};
return offset;
};
Outlayer.prototype.handleEvent=function(event){
var method='on' + event.type;
if(this[ method ]){
this[ method ](event);
}};
Outlayer.prototype.bindResize=function(){
if(this.isResizeBound){
return;
}
eventie.bind(window, 'resize', this);
this.isResizeBound=true;
};
Outlayer.prototype.unbindResize=function(){
if(this.isResizeBound){
eventie.unbind(window, 'resize', this);
}
this.isResizeBound=false;
};
Outlayer.prototype.onresize=function(){
if(this.resizeTimeout){
clearTimeout(this.resizeTimeout);
}
var _this=this;
function delayed(){
_this.resize();
delete _this.resizeTimeout;
}
this.resizeTimeout=setTimeout(delayed, 100);
};
Outlayer.prototype.resize=function(){
if(!this.isResizeBound||!this.needsResizeLayout()){
return;
}
this.layout();
};
Outlayer.prototype.needsResizeLayout=function(){
var size=getSize(this.element);
var hasSizes=this.size&&size;
return hasSizes&&size.innerWidth!==this.size.innerWidth;
};
Outlayer.prototype.addItems=function(elems){
var items=this._itemize(elems);
if(items.length){
this.items=this.items.concat(items);
}
return items;
};
Outlayer.prototype.appended=function(elems){
var items=this.addItems(elems);
if(!items.length){
return;
}
this.layoutItems(items, true);
this.reveal(items);
};
Outlayer.prototype.prepended=function(elems){
var items=this._itemize(elems);
if(!items.length){
return;
}
var previousItems=this.items.slice(0);
this.items=items.concat(previousItems);
this._resetLayout();
this._manageStamps();
this.layoutItems(items, true);
this.reveal(items);
this.layoutItems(previousItems);
};
Outlayer.prototype.reveal=function(items){
var len=items&&items.length;
if(!len){
return;
}
for(var i=0; i < len; i++){
var item=items[i];
item.reveal();
}};
Outlayer.prototype.hide=function(items){
var len=items&&items.length;
if(!len){
return;
}
for(var i=0; i < len; i++){
var item=items[i];
item.hide();
}};
Outlayer.prototype.getItem=function(elem){
for(var i=0, len=this.items.length; i < len; i++){
var item=this.items[i];
if(item.element===elem){
return item;
}}
};
Outlayer.prototype.getItems=function(elems){
if(!elems||!elems.length){
return;
}
var items=[];
for(var i=0, len=elems.length; i < len; i++){
var elem=elems[i];
var item=this.getItem(elem);
if(item){
items.push(item);
}}
return items;
};
Outlayer.prototype.remove=function(elems){
elems=makeArray(elems);
var removeItems=this.getItems(elems);
if(!removeItems||!removeItems.length){
return;
}
this._itemsOn(removeItems, 'remove', function(){
this.emitEvent('removeComplete', [ this, removeItems ]);
});
for(var i=0, len=removeItems.length; i < len; i++){
var item=removeItems[i];
item.remove();
removeFrom(item, this.items);
}};
Outlayer.prototype.destroy=function(){
var style=this.element.style;
style.height='';
style.position='';
style.width='';
for(var i=0, len=this.items.length; i < len; i++){
var item=this.items[i];
item.destroy();
}
this.unbindResize();
var id=this.element.outlayerGUID;
delete instances[ id ];
delete this.element.outlayerGUID;
if(jQuery){
jQuery.removeData(this.element, this.constructor.namespace);
}};
Outlayer.data=function(elem){
var id=elem&&elem.outlayerGUID;
return id&&instances[ id ];
};
Outlayer.create=function(namespace, options){
function Layout(){
Outlayer.apply(this, arguments);
}
if(Object.create){
Layout.prototype=Object.create(Outlayer.prototype);
}else{
extend(Layout.prototype, Outlayer.prototype);
}
Layout.prototype.constructor=Layout;
Layout.defaults=extend({}, Outlayer.defaults);
extend(Layout.defaults, options);
Layout.prototype.settings={};
Layout.namespace=namespace;
Layout.data=Outlayer.data;
Layout.Item=function LayoutItem(){
Item.apply(this, arguments);
};
Layout.Item.prototype=new Item();
docReady(function(){
var dashedNamespace=toDashed(namespace);
var elems=document.querySelectorAll('.js-' + dashedNamespace);
var dataAttr='data-' + dashedNamespace + '-options';
for(var i=0, len=elems.length; i < len; i++){
var elem=elems[i];
var attr=elem.getAttribute(dataAttr);
var options;
try {
options=attr&&JSON.parse(attr);
} catch(error){
if(console){
console.error('Error parsing ' + dataAttr + ' on ' +
elem.nodeName.toLowerCase() +(elem.id ? '#' + elem.id:'') + ': ' +
error);
}
continue;
}
var instance=new Layout(elem, options);
if(jQuery){
jQuery.data(elem, namespace, instance);
}}
});
if(jQuery&&jQuery.bridget){
jQuery.bridget(namespace, Layout);
}
return Layout;
};
Outlayer.Item=Item;
return Outlayer;
}
if(typeof define==='function'&&define.amd){
define('outlayer/outlayer',[
'eventie/eventie',
'doc-ready/doc-ready',
'eventEmitter/EventEmitter',
'get-size/get-size',
'matches-selector/matches-selector',
'./item'
],
outlayerDefinition);
}else if(typeof exports==='object'){
module.exports=outlayerDefinition(
require('eventie'),
require('doc-ready'),
require('wolfy87-eventemitter'),
require('get-size'),
require('desandro-matches-selector'),
require('./item')
);
}else{
window.Outlayer=outlayerDefinition(
window.eventie,
window.docReady,
window.EventEmitter,
window.getSize,
window.matchesSelector,
window.Outlayer.Item
);
}})(window);
(function(window){
function itemDefinition(Outlayer){
function Item(){
Outlayer.Item.apply(this, arguments);
}
Item.prototype=new Outlayer.Item();
Item.prototype._create=function(){
this.id=this.layout.itemGUID++;
Outlayer.Item.prototype._create.call(this);
this.sortData={};};
Item.prototype.updateSortData=function(){
if(this.isIgnored){
return;
}
this.sortData.id=this.id;
this.sortData['original-order']=this.id;
this.sortData.random=Math.random();
var getSortData=this.layout.options.getSortData;
var sorters=this.layout._sorters;
for(var key in getSortData){
var sorter=sorters[ key ];
this.sortData[ key ]=sorter(this.element, this);
}};
var _destroy=Item.prototype.destroy;
Item.prototype.destroy=function(){
_destroy.apply(this, arguments);
this.css({
display: ''
});
};
return Item;
}
if(typeof define==='function'&&define.amd){
define('isotope/js/item',[
'outlayer/outlayer'
],
itemDefinition);
}else if(typeof exports==='object'){
module.exports=itemDefinition(
require('outlayer')
);
}else{
window.Isotope=window.Isotope||{};
window.Isotope.Item=itemDefinition(
window.Outlayer
);
}})(window);
(function(window){
function layoutModeDefinition(getSize, Outlayer){
function LayoutMode(isotope){
this.isotope=isotope;
if(isotope){
this.options=isotope.options[ this.namespace ];
this.element=isotope.element;
this.items=isotope.filteredItems;
this.size=isotope.size;
}}
(function(){
var facadeMethods=[
'_resetLayout',
'_getItemLayoutPosition',
'_manageStamp',
'_getContainerSize',
'_getElementOffset',
'needsResizeLayout'
];
for(var i=0, len=facadeMethods.length; i < len; i++){
var methodName=facadeMethods[i];
LayoutMode.prototype[ methodName ]=getOutlayerMethod(methodName);
}
function getOutlayerMethod(methodName){
return function(){
return Outlayer.prototype[ methodName ].apply(this.isotope, arguments);
};}})();
LayoutMode.prototype.needsVerticalResizeLayout=function(){
var size=getSize(this.isotope.element);
var hasSizes=this.isotope.size&&size;
return hasSizes&&size.innerHeight!==this.isotope.size.innerHeight;
};
LayoutMode.prototype._getMeasurement=function(){
this.isotope._getMeasurement.apply(this, arguments);
};
LayoutMode.prototype.getColumnWidth=function(){
this.getSegmentSize('column', 'Width');
};
LayoutMode.prototype.getRowHeight=function(){
this.getSegmentSize('row', 'Height');
};
LayoutMode.prototype.getSegmentSize=function(segment, size){
var segmentName=segment + size;
var outerSize='outer' + size;
this._getMeasurement(segmentName, outerSize);
if(this[ segmentName ]){
return;
}
var firstItemSize=this.getFirstItemSize();
this[ segmentName ]=firstItemSize&&firstItemSize[ outerSize ] ||
this.isotope.size[ 'inner' + size ];
};
LayoutMode.prototype.getFirstItemSize=function(){
var firstItem=this.isotope.filteredItems[0];
return firstItem&&firstItem.element&&getSize(firstItem.element);
};
LayoutMode.prototype.layout=function(){
this.isotope.layout.apply(this.isotope, arguments);
};
LayoutMode.prototype.getSize=function(){
this.isotope.getSize();
this.size=this.isotope.size;
};
LayoutMode.modes={};
LayoutMode.create=function(namespace, options){
function Mode(){
LayoutMode.apply(this, arguments);
}
Mode.prototype=new LayoutMode();
if(options){
Mode.options=options;
}
Mode.prototype.namespace=namespace;
LayoutMode.modes[ namespace ]=Mode;
return Mode;
};
return LayoutMode;
}
if(typeof define==='function'&&define.amd){
define('isotope/js/layout-mode',[
'get-size/get-size',
'outlayer/outlayer'
],
layoutModeDefinition);
}else if(typeof exports==='object'){
module.exports=layoutModeDefinition(
require('get-size'),
require('outlayer')
);
}else{
window.Isotope=window.Isotope||{};
window.Isotope.LayoutMode=layoutModeDefinition(
window.getSize,
window.Outlayer
);
}})(window);
(function(window){
var indexOf=Array.prototype.indexOf ?
function(items, value){
return items.indexOf(value);
} :
function(items, value){
for(var i=0, len=items.length; i < len; i++){
var item=items[i];
if(item===value){
return i;
}}
return -1;
};
function masonryDefinition(Outlayer, getSize){
var Masonry=Outlayer.create('masonry');
Masonry.prototype._resetLayout=function(){
this.getSize();
this._getMeasurement('columnWidth', 'outerWidth');
this._getMeasurement('gutter', 'outerWidth');
this.measureColumns();
var i=this.cols;
this.colYs=[];
while (i--){
this.colYs.push(0);
}
this.maxY=0;
};
Masonry.prototype.measureColumns=function(){
this.getContainerWidth();
if(!this.columnWidth){
var firstItem=this.items[0];
var firstItemElem=firstItem&&firstItem.element;
this.columnWidth=firstItemElem&&getSize(firstItemElem).outerWidth ||
this.containerWidth;
}
this.columnWidth +=this.gutter;
this.cols=Math.floor(( this.containerWidth + this.gutter) / this.columnWidth);
this.cols=Math.max(this.cols, 1);
};
Masonry.prototype.getContainerWidth=function(){
var container=this.options.isFitWidth ? this.element.parentNode:this.element;
var size=getSize(container);
this.containerWidth=size&&size.innerWidth;
};
Masonry.prototype._getItemLayoutPosition=function(item){
item.getSize();
var remainder=item.size.outerWidth % this.columnWidth;
var mathMethod=remainder&&remainder < 1 ? 'round':'ceil';
var colSpan=Math[ mathMethod ](item.size.outerWidth / this.columnWidth);
colSpan=Math.min(colSpan, this.cols);
var colGroup=this._getColGroup(colSpan);
var minimumY=Math.min.apply(Math, colGroup);
var shortColIndex=indexOf(colGroup, minimumY);
var position={
x: this.columnWidth * shortColIndex,
y: minimumY
};
var setHeight=minimumY + item.size.outerHeight;
var setSpan=this.cols + 1 - colGroup.length;
for(var i=0; i < setSpan; i++){
this.colYs[ shortColIndex + i ]=setHeight;
}
return position;
};
Masonry.prototype._getColGroup=function(colSpan){
if(colSpan < 2){
return this.colYs;
}
var colGroup=[];
var groupCount=this.cols + 1 - colSpan;
for(var i=0; i < groupCount; i++){
var groupColYs=this.colYs.slice(i, i + colSpan);
colGroup[i]=Math.max.apply(Math, groupColYs);
}
return colGroup;
};
Masonry.prototype._manageStamp=function(stamp){
var stampSize=getSize(stamp);
var offset=this._getElementOffset(stamp);
var firstX=this.options.isOriginLeft ? offset.left:offset.right;
var lastX=firstX + stampSize.outerWidth;
var firstCol=Math.floor(firstX / this.columnWidth);
firstCol=Math.max(0, firstCol);
var lastCol=Math.floor(lastX / this.columnWidth);
lastCol -=lastX % this.columnWidth ? 0:1;
lastCol=Math.min(this.cols - 1, lastCol);
var stampMaxY=(this.options.isOriginTop ? offset.top:offset.bottom) +
stampSize.outerHeight;
for(var i=firstCol; i <=lastCol; i++){
this.colYs[i]=Math.max(stampMaxY, this.colYs[i]);
}};
Masonry.prototype._getContainerSize=function(){
this.maxY=Math.max.apply(Math, this.colYs);
var size={
height: this.maxY
};
if(this.options.isFitWidth){
size.width=this._getContainerFitWidth();
}
return size;
};
Masonry.prototype._getContainerFitWidth=function(){
var unusedCols=0;
var i=this.cols;
while(--i){
if(this.colYs[i]!==0){
break;
}
unusedCols++;
}
return(this.cols - unusedCols) * this.columnWidth - this.gutter;
};
Masonry.prototype.needsResizeLayout=function(){
var previousWidth=this.containerWidth;
this.getContainerWidth();
return previousWidth!==this.containerWidth;
};
return Masonry;
}
if(typeof define==='function'&&define.amd){
define('masonry/masonry',[
'outlayer/outlayer',
'get-size/get-size'
],
masonryDefinition);
}else if(typeof exports==='object'){
module.exports=masonryDefinition(
require('outlayer'),
require('get-size')
);
}else{
window.Masonry=masonryDefinition(
window.Outlayer,
window.getSize
);
}})(window);
(function(window){
function extend(a, b){
for(var prop in b){
a[ prop ]=b[ prop ];
}
return a;
}
function masonryDefinition(LayoutMode, Masonry){
var MasonryMode=LayoutMode.create('masonry');
var _getElementOffset=MasonryMode.prototype._getElementOffset;
var layout=MasonryMode.prototype.layout;
var _getMeasurement=MasonryMode.prototype._getMeasurement;
extend(MasonryMode.prototype, Masonry.prototype);
MasonryMode.prototype._getElementOffset=_getElementOffset;
MasonryMode.prototype.layout=layout;
MasonryMode.prototype._getMeasurement=_getMeasurement;
var measureColumns=MasonryMode.prototype.measureColumns;
MasonryMode.prototype.measureColumns=function(){
this.items=this.isotope.filteredItems;
measureColumns.call(this);
};
var _manageStamp=MasonryMode.prototype._manageStamp;
MasonryMode.prototype._manageStamp=function(){
this.options.isOriginLeft=this.isotope.options.isOriginLeft;
this.options.isOriginTop=this.isotope.options.isOriginTop;
_manageStamp.apply(this, arguments);
};
return MasonryMode;
}
if(typeof define==='function'&&define.amd){
define('isotope/js/layout-modes/masonry',[
'../layout-mode',
'masonry/masonry'
],
masonryDefinition);
}else if(typeof exports==='object'){
module.exports=masonryDefinition(
require('../layout-mode'),
require('masonry-layout')
);
}else{
masonryDefinition(
window.Isotope.LayoutMode,
window.Masonry
);
}})(window);
(function(window){
function fitRowsDefinition(LayoutMode){
var FitRows=LayoutMode.create('fitRows');
FitRows.prototype._resetLayout=function(){
this.x=0;
this.y=0;
this.maxY=0;
this._getMeasurement('gutter', 'outerWidth');
};
FitRows.prototype._getItemLayoutPosition=function(item){
item.getSize();
var itemWidth=item.size.outerWidth + this.gutter;
var containerWidth=this.isotope.size.innerWidth + this.gutter;
if(this.x!==0&&itemWidth + this.x > containerWidth){
this.x=0;
this.y=this.maxY;
}
var position={
x: this.x,
y: this.y
};
this.maxY=Math.max(this.maxY, this.y + item.size.outerHeight);
this.x +=itemWidth;
return position;
};
FitRows.prototype._getContainerSize=function(){
return { height: this.maxY };};
return FitRows;
}
if(typeof define==='function'&&define.amd){
define('isotope/js/layout-modes/fit-rows',[
'../layout-mode'
],
fitRowsDefinition);
}else if(typeof exports==='object'){
module.exports=fitRowsDefinition(
require('../layout-mode')
);
}else{
fitRowsDefinition(
window.Isotope.LayoutMode
);
}})(window);
(function(window){
function verticalDefinition(LayoutMode){
var Vertical=LayoutMode.create('vertical', {
horizontalAlignment: 0
});
Vertical.prototype._resetLayout=function(){
this.y=0;
};
Vertical.prototype._getItemLayoutPosition=function(item){
item.getSize();
var x=(this.isotope.size.innerWidth - item.size.outerWidth) *
this.options.horizontalAlignment;
var y=this.y;
this.y +=item.size.outerHeight;
return { x: x, y: y };};
Vertical.prototype._getContainerSize=function(){
return { height: this.y };};
return Vertical;
}
if(typeof define==='function'&&define.amd){
define('isotope/js/layout-modes/vertical',[
'../layout-mode'
],
verticalDefinition);
}else if(typeof exports==='object'){
module.exports=verticalDefinition(
require('../layout-mode')
);
}else{
verticalDefinition(
window.Isotope.LayoutMode
);
}})(window);
(function(window){
var jQuery=window.jQuery;
function extend(a, b){
for(var prop in b){
a[ prop ]=b[ prop ];
}
return a;
}
var trim=String.prototype.trim ?
function(str){
return str.trim();
} :
function(str){
return str.replace(/^\s+|\s+$/g, '');
};
var docElem=document.documentElement;
var getText=docElem.textContent ?
function(elem){
return elem.textContent;
} :
function(elem){
return elem.innerText;
};
var objToString=Object.prototype.toString;
function isArray(obj){
return objToString.call(obj)==='[object Array]';
}
var indexOf=Array.prototype.indexOf ? function(ary, obj){
return ary.indexOf(obj);
}:function(ary, obj){
for(var i=0, len=ary.length; i < len; i++){
if(ary[i]===obj){
return i;
}}
return -1;
};
function makeArray(obj){
var ary=[];
if(isArray(obj)){
ary=obj;
}else if(obj&&typeof obj.length==='number'){
for(var i=0, len=obj.length; i < len; i++){
ary.push(obj[i]);
}}else{
ary.push(obj);
}
return ary;
}
function removeFrom(obj, ary){
var index=indexOf(ary, obj);
if(index!==-1){
ary.splice(index, 1);
}}
function isotopeDefinition(Outlayer, getSize, matchesSelector, Item, LayoutMode){
var Isotope=Outlayer.create('isotope', {
layoutMode: "masonry",
isJQueryFiltering: true,
sortAscending: true
});
Isotope.Item=Item;
Isotope.LayoutMode=LayoutMode;
Isotope.prototype._create=function(){
this.itemGUID=0;
this._sorters={};
this._getSorters();
Outlayer.prototype._create.call(this);
this.modes={};
this.filteredItems=this.items;
this.sortHistory=[ 'original-order' ];
for(var name in LayoutMode.modes){
this._initLayoutMode(name);
}};
Isotope.prototype.reloadItems=function(){
this.itemGUID=0;
Outlayer.prototype.reloadItems.call(this);
};
Isotope.prototype._itemize=function(){
var items=Outlayer.prototype._itemize.apply(this, arguments);
for(var i=0, len=items.length; i < len; i++){
var item=items[i];
item.id=this.itemGUID++;
}
this._updateItemsSortData(items);
return items;
};
Isotope.prototype._initLayoutMode=function(name){
var Mode=LayoutMode.modes[ name ];
var initialOpts=this.options[ name ]||{};
this.options[ name ]=Mode.options ?
extend(Mode.options, initialOpts):initialOpts;
this.modes[ name ]=new Mode(this);
};
Isotope.prototype.layout=function(){
if(!this._isLayoutInited&&this.options.isInitLayout){
this.arrange();
return;
}
this._layout();
};
Isotope.prototype._layout=function(){
var isInstant=this._getIsInstant();
this._resetLayout();
this._manageStamps();
this.layoutItems(this.filteredItems, isInstant);
this._isLayoutInited=true;
};
Isotope.prototype.arrange=function(opts){
this.option(opts);
this._getIsInstant();
this.filteredItems=this._filter(this.items);
this._sort();
this._layout();
};
Isotope.prototype._init=Isotope.prototype.arrange;
Isotope.prototype._getIsInstant=function(){
var isInstant=this.options.isLayoutInstant!==undefined ?
this.options.isLayoutInstant:!this._isLayoutInited;
this._isInstant=isInstant;
return isInstant;
};
Isotope.prototype._filter=function(items){
var filter=this.options.filter;
filter=filter||'*';
var matches=[];
var hiddenMatched=[];
var visibleUnmatched=[];
var test=this._getFilterTest(filter);
for(var i=0, len=items.length; i < len; i++){
var item=items[i];
if(item.isIgnored){
continue;
}
var isMatched=test(item);
if(isMatched){
matches.push(item);
}
if(isMatched&&item.isHidden){
hiddenMatched.push(item);
}else if(!isMatched&&!item.isHidden){
visibleUnmatched.push(item);
}}
var _this=this;
function hideReveal(){
_this.reveal(hiddenMatched);
_this.hide(visibleUnmatched);
}
if(this._isInstant){
this._noTransition(hideReveal);
}else{
hideReveal();
}
return matches;
};
Isotope.prototype._getFilterTest=function(filter){
if(jQuery&&this.options.isJQueryFiltering){
return function(item){
return jQuery(item.element).is(filter);
};}
if(typeof filter==='function'){
return function(item){
return filter(item.element);
};}
return function(item){
return matchesSelector(item.element, filter);
};};
Isotope.prototype.updateSortData=function(elems){
var items;
if(elems){
elems=makeArray(elems);
items=this.getItems(elems);
}else{
items=this.items;
}
this._getSorters();
this._updateItemsSortData(items);
};
Isotope.prototype._getSorters=function(){
var getSortData=this.options.getSortData;
for(var key in getSortData){
var sorter=getSortData[ key ];
this._sorters[ key ]=mungeSorter(sorter);
}};
Isotope.prototype._updateItemsSortData=function(items){
var len=items&&items.length;
for(var i=0; len&&i < len; i++){
var item=items[i];
item.updateSortData();
}};
var mungeSorter=(function(){
function mungeSorter(sorter){
if(typeof sorter!=='string'){
return sorter;
}
var args=trim(sorter).split(' ');
var query=args[0];
var attrMatch=query.match(/^\[(.+)\]$/);
var attr=attrMatch&&attrMatch[1];
var getValue=getValueGetter(attr, query);
var parser=Isotope.sortDataParsers[ args[1] ];
sorter=parser ? function(elem){
return elem&&parser(getValue(elem));
} :
function(elem){
return elem&&getValue(elem);
};
return sorter;
}
function getValueGetter(attr, query){
var getValue;
if(attr){
getValue=function(elem){
return elem.getAttribute(attr);
};}else{
getValue=function(elem){
var child=elem.querySelector(query);
return child&&getText(child);
};}
return getValue;
}
return mungeSorter;
})();
Isotope.sortDataParsers={
'parseInt': function(val){
return parseInt(val, 10);
},
'parseFloat': function(val){
return parseFloat(val);
}};
Isotope.prototype._sort=function(){
var sortByOpt=this.options.sortBy;
if(!sortByOpt){
return;
}
var sortBys=[].concat.apply(sortByOpt, this.sortHistory);
var itemSorter=getItemSorter(sortBys, this.options.sortAscending);
this.filteredItems.sort(itemSorter);
if(sortByOpt!==this.sortHistory[0]){
this.sortHistory.unshift(sortByOpt);
}};
function getItemSorter(sortBys, sortAsc){
return function sorter(itemA, itemB){
for(var i=0, len=sortBys.length; i < len; i++){
var sortBy=sortBys[i];
var a=itemA.sortData[ sortBy ];
var b=itemB.sortData[ sortBy ];
if(a > b||a < b){
var isAscending=sortAsc[ sortBy ]!==undefined ? sortAsc[ sortBy ]:sortAsc;
var direction=isAscending ? 1:-1;
return(a > b ? 1:-1) * direction;
}}
return 0;
};}
Isotope.prototype._mode=function(){
var layoutMode=this.options.layoutMode;
var mode=this.modes[ layoutMode ];
if(!mode){
throw new Error('No layout mode: ' + layoutMode);
}
mode.options=this.options[ layoutMode ];
return mode;
};
Isotope.prototype._resetLayout=function(){
Outlayer.prototype._resetLayout.call(this);
this._mode()._resetLayout();
};
Isotope.prototype._getItemLayoutPosition=function(item){
return this._mode()._getItemLayoutPosition(item);
};
Isotope.prototype._manageStamp=function(stamp){
this._mode()._manageStamp(stamp);
};
Isotope.prototype._getContainerSize=function(){
return this._mode()._getContainerSize();
};
Isotope.prototype.needsResizeLayout=function(){
return this._mode().needsResizeLayout();
};
Isotope.prototype.appended=function(elems){
var items=this.addItems(elems);
if(!items.length){
return;
}
var filteredItems=this._filterRevealAdded(items);
this.filteredItems=this.filteredItems.concat(filteredItems);
};
Isotope.prototype.prepended=function(elems){
var items=this._itemize(elems);
if(!items.length){
return;
}
var previousItems=this.items.slice(0);
this.items=items.concat(previousItems);
this._resetLayout();
this._manageStamps();
var filteredItems=this._filterRevealAdded(items);
this.layoutItems(previousItems);
this.filteredItems=filteredItems.concat(this.filteredItems);
};
Isotope.prototype._filterRevealAdded=function(items){
var filteredItems=this._noTransition(function(){
return this._filter(items);
});
this.layoutItems(filteredItems, true);
this.reveal(filteredItems);
return items;
};
Isotope.prototype.insert=function(elems){
var items=this.addItems(elems);
if(!items.length){
return;
}
var i, item;
var len=items.length;
for(i=0; i < len; i++){
item=items[i];
this.element.appendChild(item.element);
}
/*
var filteredInsertItems;
this._noTransition(function(){
filteredInsertItems=this._filter(items);
this.hide(filteredInsertItems);
});
// */
var filteredInsertItems=this._filter(items);
this._noTransition(function(){
this.hide(filteredInsertItems);
});
// */
for(i=0; i < len; i++){
items[i].isLayoutInstant=true;
}
this.arrange();
for(i=0; i < len; i++){
delete items[i].isLayoutInstant;
}
this.reveal(filteredInsertItems);
};
var _remove=Isotope.prototype.remove;
Isotope.prototype.remove=function(elems){
elems=makeArray(elems);
var removeItems=this.getItems(elems);
_remove.call(this, elems);
if(!removeItems||!removeItems.length){
return;
}
for(var i=0, len=removeItems.length; i < len; i++){
var item=removeItems[i];
removeFrom(item, this.filteredItems);
}};
Isotope.prototype.shuffle=function(){
for(var i=0, len=this.items.length; i < len; i++){
var item=this.items[i];
item.sortData.random=Math.random();
}
this.options.sortBy='random';
this._sort();
this._layout();
};
Isotope.prototype._noTransition=function(fn){
var transitionDuration=this.options.transitionDuration;
this.options.transitionDuration=0;
var returnValue=fn.call(this);
this.options.transitionDuration=transitionDuration;
return returnValue;
};
Isotope.prototype.getFilteredItemElements=function(){
var elems=[];
for(var i=0, len=this.filteredItems.length; i < len; i++){
elems.push(this.filteredItems[i].element);
}
return elems;
};
return Isotope;
}
if(typeof define==='function'&&define.amd){
define([
'outlayer/outlayer',
'get-size/get-size',
'matches-selector/matches-selector',
'isotope/js/item',
'isotope/js/layout-mode',
'isotope/js/layout-modes/masonry',
'isotope/js/layout-modes/fit-rows',
'isotope/js/layout-modes/vertical'
],
isotopeDefinition);
}else if(typeof exports==='object'){
module.exports=isotopeDefinition(
require('outlayer'),
require('get-size'),
require('desandro-matches-selector'),
require('./item'),
require('./layout-mode'),
require('./layout-modes/masonry'),
require('./layout-modes/fit-rows'),
require('./layout-modes/vertical')
);
}else{
window.Isotope=isotopeDefinition(
window.Outlayer,
window.getSize,
window.matchesSelector,
window.Isotope.Item,
window.Isotope.LayoutMode
);
}})(window);
(function($){
$.fn.appear=function(fn, options){
var settings=$.extend({
data: undefined,
one: true,
accX: 0,
accY: 0
}, options);
return this.each(function(){
var t=$(this);
t.appeared=false;
if(!fn){
t.trigger('appear', settings.data);
return;
}
var w=$(window);
var check=function(){
if(!t.is(':visible')){
t.appeared=false;
return;
}
var a=w.scrollLeft();
var b=w.scrollTop();
var o=t.offset();
var x=o.left;
var y=o.top;
var ax=settings.accX;
var ay=settings.accY;
var th=t.height();
var wh=w.height();
var tw=t.width();
var ww=w.width();
if(y + th + ay >=b &&
y <=b + wh + ay &&
x + tw + ax >=a &&
x <=a + ww + ax){
if(!t.appeared) t.trigger('appear', settings.data);
}else{
t.appeared=false;
}};
var modifiedFn=function(){
t.appeared=true;
if(settings.one){
w.unbind('scroll', check);
var i=$.inArray(check, $.fn.appear.checks);
if(i >=0) $.fn.appear.checks.splice(i, 1);
}
fn.apply(this, arguments);
};
if(settings.one) t.one('appear', settings.data, modifiedFn);
else t.bind('appear', settings.data, modifiedFn);
w.scroll(check);
$.fn.appear.checks.push(check);
(check)();
});
};
$.extend($.fn.appear, {
checks: [],
timeout: null,
checkAll: function(){
var length=$.fn.appear.checks.length;
if(length > 0) while (length--) ($.fn.appear.checks[length])();
},
run: function(){
if($.fn.appear.timeout) clearTimeout($.fn.appear.timeout);
$.fn.appear.timeout=setTimeout($.fn.appear.checkAll, 20);
}});
$.each(['append', 'prepend', 'after', 'before', 'attr',
'removeAttr', 'addClass', 'removeClass', 'toggleClass',
'remove', 'css', 'show', 'hide'], function(i, n){
var old=$.fn[n];
if(old){
$.fn[n]=function(){
var r=old.apply(this, arguments);
$.fn.appear.run();
return r;
}}
});
})(jQuery);
(function (factory){
if(typeof define==='function'&&define.amd&&define.amd.jQuery){
define(['jquery'], factory);
}else{
factory(jQuery);
}}(function ($){
"use strict";
var LEFT="left",
RIGHT="right",
UP="up",
DOWN="down",
IN="in",
OUT="out",
NONE="none",
AUTO="auto",
SWIPE="swipe",
PINCH="pinch",
TAP="tap",
DOUBLE_TAP="doubletap",
LONG_TAP="longtap",
HOLD="hold",
HORIZONTAL="horizontal",
VERTICAL="vertical",
ALL_FINGERS="all",
DOUBLE_TAP_THRESHOLD=10,
PHASE_START="start",
PHASE_MOVE="move",
PHASE_END="end",
PHASE_CANCEL="cancel",
SUPPORTS_TOUCH='ontouchstart' in window,
SUPPORTS_POINTER_IE10=window.navigator.msPointerEnabled&&!window.navigator.pointerEnabled,
SUPPORTS_POINTER=window.navigator.pointerEnabled||window.navigator.msPointerEnabled,
PLUGIN_NS='TouchSwipe';
var defaults={
fingers: 1,
threshold: 75,
cancelThreshold:null,
pinchThreshold:20,
maxTimeThreshold: null,
fingerReleaseThreshold:250,
longTapThreshold:500,
doubleTapThreshold:200,
swipe: null,
swipeLeft: null,
swipeRight: null,
swipeUp: null,
swipeDown: null,
swipeStatus: null,
pinchIn:null,
pinchOut:null,
pinchStatus:null,
click:null,
tap:null,
doubleTap:null,
longTap:null,
hold:null,
triggerOnTouchEnd: true,
triggerOnTouchLeave:false,
allowPageScroll: "auto",
fallbackToMouseEvents: true,
excludedElements:"label, button, input, select, textarea, a, .noSwipe"
};
$.fn.swipe=function (method){
var $this=$(this),
plugin=$this.data(PLUGIN_NS);
if(plugin&&typeof method==='string'){
if(plugin[method]){
return plugin[method].apply(this, Array.prototype.slice.call(arguments, 1));
}else{
$.error('Method ' + method + ' does not exist on jQuery.swipe');
}}
else if(!plugin&&(typeof method==='object'||!method)){
return init.apply(this, arguments);
}
return $this;
};
$.fn.swipe.defaults=defaults;
$.fn.swipe.phases={
PHASE_START: PHASE_START,
PHASE_MOVE: PHASE_MOVE,
PHASE_END: PHASE_END,
PHASE_CANCEL: PHASE_CANCEL
};
$.fn.swipe.directions={
LEFT: LEFT,
RIGHT: RIGHT,
UP: UP,
DOWN: DOWN,
IN:IN,
OUT: OUT
};
$.fn.swipe.pageScroll={
NONE: NONE,
HORIZONTAL: HORIZONTAL,
VERTICAL: VERTICAL,
AUTO: AUTO
};
$.fn.swipe.fingers={
ONE: 1,
TWO: 2,
THREE: 3,
ALL: ALL_FINGERS
};
function init(options){
if(options&&(options.allowPageScroll===undefined&&(options.swipe!==undefined||options.swipeStatus!==undefined))){
options.allowPageScroll=NONE;
}
if(options.click!==undefined&&options.tap===undefined){
options.tap=options.click;
}
if(!options){
options={};}
options=$.extend({}, $.fn.swipe.defaults, options);
return this.each(function (){
var $this=$(this);
var plugin=$this.data(PLUGIN_NS);
if(!plugin){
plugin=new TouchSwipe(this, options);
$this.data(PLUGIN_NS, plugin);
}});
}
function TouchSwipe(element, options){
var useTouchEvents=(SUPPORTS_TOUCH||SUPPORTS_POINTER||!options.fallbackToMouseEvents),
START_EV=useTouchEvents ? (SUPPORTS_POINTER ? (SUPPORTS_POINTER_IE10 ? 'MSPointerDown':'pointerdown'):'touchstart'):'mousedown',
MOVE_EV=useTouchEvents ? (SUPPORTS_POINTER ? (SUPPORTS_POINTER_IE10 ? 'MSPointerMove':'pointermove'):'touchmove'):'mousemove',
END_EV=useTouchEvents ? (SUPPORTS_POINTER ? (SUPPORTS_POINTER_IE10 ? 'MSPointerUp':'pointerup'):'touchend'):'mouseup',
LEAVE_EV=useTouchEvents ? null:'mouseleave',
CANCEL_EV=(SUPPORTS_POINTER ? (SUPPORTS_POINTER_IE10 ? 'MSPointerCancel':'pointercancel'):'touchcancel');
var distance=0,
direction=null,
duration=0,
startTouchesDistance=0,
endTouchesDistance=0,
pinchZoom=1,
pinchDistance=0,
pinchDirection=0,
maximumsMap=null;
var $element=$(element);
var phase="start";
var fingerCount=0;
var fingerData=null;
var startTime=0,
endTime=0,
previousTouchEndTime=0,
previousTouchFingerCount=0,
doubleTapStartTime=0;
var singleTapTimeout=null,
holdTimeout=null;
try {
$element.bind(START_EV, touchStart);
$element.bind(CANCEL_EV, touchCancel);
}
catch (e){
$.error('events not supported ' + START_EV + ',' + CANCEL_EV + ' on jQuery.swipe');
}
this.enable=function (){
$element.bind(START_EV, touchStart);
$element.bind(CANCEL_EV, touchCancel);
return $element;
};
this.disable=function (){
removeListeners();
return $element;
};
this.destroy=function (){
removeListeners();
$element.data(PLUGIN_NS, null);
return $element;
};
this.option=function (property, value){
if(options[property]!==undefined){
if(value===undefined){
return options[property];
}else{
options[property]=value;
}}else{
$.error('Option ' + property + ' does not exist on jQuery.swipe.options');
}
return null;
};
function touchStart(jqEvent){
if(getTouchInProgress())
return;
if($(jqEvent.target).closest(options.excludedElements, $element).length>0)
return;
var event=jqEvent.originalEvent ? jqEvent.originalEvent:jqEvent;
var ret,
evt=SUPPORTS_TOUCH ? event.touches[0]:event;
phase=PHASE_START;
if(SUPPORTS_TOUCH){
fingerCount=event.touches.length;
}else{
jqEvent.preventDefault();
}
distance=0;
direction=null;
pinchDirection=null;
duration=0;
startTouchesDistance=0;
endTouchesDistance=0;
pinchZoom=1;
pinchDistance=0;
fingerData=createAllFingerData();
maximumsMap=createMaximumsData();
cancelMultiFingerRelease();
if(!SUPPORTS_TOUCH||(fingerCount===options.fingers||options.fingers===ALL_FINGERS)||hasPinches()){
createFingerData(0, evt);
startTime=getTimeStamp();
if(fingerCount==2){
createFingerData(1, event.touches[1]);
startTouchesDistance=endTouchesDistance=calculateTouchesDistance(fingerData[0].start, fingerData[1].start);
}
if(options.swipeStatus||options.pinchStatus){
ret=triggerHandler(event, phase);
}}else{
ret=false;
}
if(ret===false){
phase=PHASE_CANCEL;
triggerHandler(event, phase);
return ret;
}else{
if(options.hold){
holdTimeout=setTimeout($.proxy(function(){
$element.trigger('hold', [event.target]);
if(options.hold){
ret=options.hold.call($element, event, event.target);
}}, this), options.longTapThreshold);
}
setTouchInProgress(true);
}
return null;
};
function touchMove(jqEvent){
var event=jqEvent.originalEvent ? jqEvent.originalEvent:jqEvent;
if(phase===PHASE_END||phase===PHASE_CANCEL||inMultiFingerRelease())
return;
var ret,
evt=SUPPORTS_TOUCH ? event.touches[0]:event;
var currentFinger=updateFingerData(evt);
endTime=getTimeStamp();
if(SUPPORTS_TOUCH){
fingerCount=event.touches.length;
}
if(options.hold)
clearTimeout(holdTimeout);
phase=PHASE_MOVE;
if(fingerCount==2){
if(startTouchesDistance==0){
createFingerData(1, event.touches[1]);
startTouchesDistance=endTouchesDistance=calculateTouchesDistance(fingerData[0].start, fingerData[1].start);
}else{
updateFingerData(event.touches[1]);
endTouchesDistance=calculateTouchesDistance(fingerData[0].end, fingerData[1].end);
pinchDirection=calculatePinchDirection(fingerData[0].end, fingerData[1].end);
}
pinchZoom=calculatePinchZoom(startTouchesDistance, endTouchesDistance);
pinchDistance=Math.abs(startTouchesDistance - endTouchesDistance);
}
if((fingerCount===options.fingers||options.fingers===ALL_FINGERS)||!SUPPORTS_TOUCH||hasPinches()){
direction=calculateDirection(currentFinger.start, currentFinger.end);
validateDefaultEvent(jqEvent, direction);
distance=calculateDistance(currentFinger.start, currentFinger.end);
duration=calculateDuration();
setMaxDistance(direction, distance);
if(options.swipeStatus||options.pinchStatus){
ret=triggerHandler(event, phase);
}
if(!options.triggerOnTouchEnd||options.triggerOnTouchLeave){
var inBounds=true;
if(options.triggerOnTouchLeave){
var bounds=getbounds(this);
inBounds=isInBounds(currentFinger.end, bounds);
}
if(!options.triggerOnTouchEnd&&inBounds){
phase=getNextPhase(PHASE_MOVE);
}
else if(options.triggerOnTouchLeave&&!inBounds){
phase=getNextPhase(PHASE_END);
}
if(phase==PHASE_CANCEL||phase==PHASE_END){
triggerHandler(event, phase);
}}
}else{
phase=PHASE_CANCEL;
triggerHandler(event, phase);
}
if(ret===false){
phase=PHASE_CANCEL;
triggerHandler(event, phase);
}}
function touchEnd(jqEvent){
var event=jqEvent.originalEvent;
if(SUPPORTS_TOUCH){
if(event.touches.length>0){
startMultiFingerRelease();
return true;
}}
if(inMultiFingerRelease()){
fingerCount=previousTouchFingerCount;
}
endTime=getTimeStamp();
duration=calculateDuration();
if(didSwipeBackToCancel()||!validateSwipeDistance()){
phase=PHASE_CANCEL;
triggerHandler(event, phase);
}else if(options.triggerOnTouchEnd||(options.triggerOnTouchEnd==false&&phase===PHASE_MOVE)){
jqEvent.preventDefault();
phase=PHASE_END;
triggerHandler(event, phase);
}
else if(!options.triggerOnTouchEnd&&hasTap()){
phase=PHASE_END;
triggerHandlerForGesture(event, phase, TAP);
}
else if(phase===PHASE_MOVE){
phase=PHASE_CANCEL;
triggerHandler(event, phase);
}
setTouchInProgress(false);
return null;
}
function touchCancel(){
fingerCount=0;
endTime=0;
startTime=0;
startTouchesDistance=0;
endTouchesDistance=0;
pinchZoom=1;
cancelMultiFingerRelease();
setTouchInProgress(false);
}
function touchLeave(jqEvent){
var event=jqEvent.originalEvent;
if(options.triggerOnTouchLeave){
phase=getNextPhase(PHASE_END);
triggerHandler(event, phase);
}}
function removeListeners(){
$element.unbind(START_EV, touchStart);
$element.unbind(CANCEL_EV, touchCancel);
$element.unbind(MOVE_EV, touchMove);
$element.unbind(END_EV, touchEnd);
if(LEAVE_EV){
$element.unbind(LEAVE_EV, touchLeave);
}
setTouchInProgress(false);
}
function getNextPhase(currentPhase){
var nextPhase=currentPhase;
var validTime=validateSwipeTime();
var validDistance=validateSwipeDistance();
var didCancel=didSwipeBackToCancel();
if(!validTime||didCancel){
nextPhase=PHASE_CANCEL;
}
else if(validDistance&¤tPhase==PHASE_MOVE&&(!options.triggerOnTouchEnd||options.triggerOnTouchLeave)){
nextPhase=PHASE_END;
}
else if(!validDistance&¤tPhase==PHASE_END&&options.triggerOnTouchLeave){
nextPhase=PHASE_CANCEL;
}
return nextPhase;
}
function triggerHandler(event, phase){
var ret=undefined;
if(didSwipe()||hasSwipes()){
ret=triggerHandlerForGesture(event, phase, SWIPE);
}
else if((didPinch()||hasPinches())&&ret!==false){
ret=triggerHandlerForGesture(event, phase, PINCH);
}
if(didDoubleTap()&&ret!==false){
ret=triggerHandlerForGesture(event, phase, DOUBLE_TAP);
}
else if(didLongTap()&&ret!==false){
ret=triggerHandlerForGesture(event, phase, LONG_TAP);
}
else if(didTap()&&ret!==false){
ret=triggerHandlerForGesture(event, phase, TAP);
}
if(phase===PHASE_CANCEL){
touchCancel(event);
}
if(phase===PHASE_END){
if(SUPPORTS_TOUCH){
if(event.touches.length==0){
touchCancel(event);
}}else{
touchCancel(event);
}}
return ret;
}
function triggerHandlerForGesture(event, phase, gesture){
var ret=undefined;
if(gesture==SWIPE){
$element.trigger('swipeStatus', [phase, direction||null, distance||0, duration||0, fingerCount, fingerData]);
if(options.swipeStatus){
ret=options.swipeStatus.call($element, event, phase, direction||null, distance||0, duration||0, fingerCount, fingerData);
if(ret===false) return false;
}
if(phase==PHASE_END&&validateSwipe()){
$element.trigger('swipe', [direction, distance, duration, fingerCount, fingerData]);
if(options.swipe){
ret=options.swipe.call($element, event, direction, distance, duration, fingerCount, fingerData);
if(ret===false) return false;
}
switch (direction){
case LEFT:
$element.trigger('swipeLeft', [direction, distance, duration, fingerCount, fingerData]);
if(options.swipeLeft){
ret=options.swipeLeft.call($element, event, direction, distance, duration, fingerCount, fingerData);
}
break;
case RIGHT:
$element.trigger('swipeRight', [direction, distance, duration, fingerCount, fingerData]);
if(options.swipeRight){
ret=options.swipeRight.call($element, event, direction, distance, duration, fingerCount, fingerData);
}
break;
case UP:
$element.trigger('swipeUp', [direction, distance, duration, fingerCount, fingerData]);
if(options.swipeUp){
ret=options.swipeUp.call($element, event, direction, distance, duration, fingerCount, fingerData);
}
break;
case DOWN:
$element.trigger('swipeDown', [direction, distance, duration, fingerCount, fingerData]);
if(options.swipeDown){
ret=options.swipeDown.call($element, event, direction, distance, duration, fingerCount, fingerData);
}
break;
}}
}
if(gesture==PINCH){
$element.trigger('pinchStatus', [phase, pinchDirection||null, pinchDistance||0, duration||0, fingerCount, pinchZoom, fingerData]);
if(options.pinchStatus){
ret=options.pinchStatus.call($element, event, phase, pinchDirection||null, pinchDistance||0, duration||0, fingerCount, pinchZoom, fingerData);
if(ret===false) return false;
}
if(phase==PHASE_END&&validatePinch()){
switch (pinchDirection){
case IN:
$element.trigger('pinchIn', [pinchDirection||null, pinchDistance||0, duration||0, fingerCount, pinchZoom, fingerData]);
if(options.pinchIn){
ret=options.pinchIn.call($element, event, pinchDirection||null, pinchDistance||0, duration||0, fingerCount, pinchZoom, fingerData);
}
break;
case OUT:
$element.trigger('pinchOut', [pinchDirection||null, pinchDistance||0, duration||0, fingerCount, pinchZoom, fingerData]);
if(options.pinchOut){
ret=options.pinchOut.call($element, event, pinchDirection||null, pinchDistance||0, duration||0, fingerCount, pinchZoom, fingerData);
}
break;
}}
}
if(gesture==TAP){
if(phase===PHASE_CANCEL||phase===PHASE_END){
clearTimeout(singleTapTimeout);
clearTimeout(holdTimeout);
if(hasDoubleTap()&&!inDoubleTap()){
doubleTapStartTime=getTimeStamp();
singleTapTimeout=setTimeout($.proxy(function(){
doubleTapStartTime=null;
$element.trigger('tap', [event.target]);
if(options.tap){
ret=options.tap.call($element, event, event.target);
}}, this), options.doubleTapThreshold);
}else{
doubleTapStartTime=null;
$element.trigger('tap', [event.target]);
if(options.tap){
ret=options.tap.call($element, event, event.target);
}}
}}
else if(gesture==DOUBLE_TAP){
if(phase===PHASE_CANCEL||phase===PHASE_END){
clearTimeout(singleTapTimeout);
doubleTapStartTime=null;
$element.trigger('doubletap', [event.target]);
if(options.doubleTap){
ret=options.doubleTap.call($element, event, event.target);
}}
}
else if(gesture==LONG_TAP){
if(phase===PHASE_CANCEL||phase===PHASE_END){
clearTimeout(singleTapTimeout);
doubleTapStartTime=null;
$element.trigger('longtap', [event.target]);
if(options.longTap){
ret=options.longTap.call($element, event, event.target);
}}
}
return ret;
}
function validateSwipeDistance(){
var valid=true;
if(options.threshold!==null){
valid=distance >=options.threshold;
}
return valid;
}
function didSwipeBackToCancel(){
var cancelled=false;
if(options.cancelThreshold!==null&&direction!==null){
cancelled=(getMaxDistance(direction) - distance) >=options.cancelThreshold;
}
return cancelled;
}
function validatePinchDistance(){
if(options.pinchThreshold!==null){
return pinchDistance >=options.pinchThreshold;
}
return true;
}
function validateSwipeTime(){
var result;
if(options.maxTimeThreshold){
if(duration >=options.maxTimeThreshold){
result=false;
}else{
result=true;
}}else{
result=true;
}
return result;
}
function validateDefaultEvent(jqEvent, direction){
if(options.allowPageScroll===NONE||hasPinches()){
jqEvent.preventDefault();
}else{
var auto=options.allowPageScroll===AUTO;
switch (direction){
case LEFT:
if((options.swipeLeft&&auto)||(!auto&&options.allowPageScroll!=HORIZONTAL)){
jqEvent.preventDefault();
}
break;
case RIGHT:
if((options.swipeRight&&auto)||(!auto&&options.allowPageScroll!=HORIZONTAL)){
jqEvent.preventDefault();
}
break;
case UP:
if((options.swipeUp&&auto)||(!auto&&options.allowPageScroll!=VERTICAL)){
jqEvent.preventDefault();
}
break;
case DOWN:
if((options.swipeDown&&auto)||(!auto&&options.allowPageScroll!=VERTICAL)){
jqEvent.preventDefault();
}
break;
}}
}
function validatePinch(){
var hasCorrectFingerCount=validateFingers();
var hasEndPoint=validateEndPoint();
var hasCorrectDistance=validatePinchDistance();
return hasCorrectFingerCount&&hasEndPoint&&hasCorrectDistance;
}
function hasPinches(){
return !!(options.pinchStatus||options.pinchIn||options.pinchOut);
}
function didPinch(){
return !!(validatePinch()&&hasPinches());
}
function validateSwipe(){
var hasValidTime=validateSwipeTime();
var hasValidDistance=validateSwipeDistance();
var hasCorrectFingerCount=validateFingers();
var hasEndPoint=validateEndPoint();
var didCancel=didSwipeBackToCancel();
var valid = !didCancel&&hasEndPoint&&hasCorrectFingerCount&&hasValidDistance&&hasValidTime;
return valid;
}
function hasSwipes(){
return !!(options.swipe||options.swipeStatus||options.swipeLeft||options.swipeRight||options.swipeUp||options.swipeDown);
}
function didSwipe(){
return !!(validateSwipe()&&hasSwipes());
}
function validateFingers(){
return ((fingerCount===options.fingers||options.fingers===ALL_FINGERS)||!SUPPORTS_TOUCH);
}
function validateEndPoint(){
return fingerData[0].end.x!==0;
}
function hasTap(){
return !!(options.tap) ;
}
function hasDoubleTap(){
return !!(options.doubleTap) ;
}
function hasLongTap(){
return !!(options.longTap) ;
}
function validateDoubleTap(){
if(doubleTapStartTime==null){
return false;
}
var now=getTimeStamp();
return (hasDoubleTap()&&((now-doubleTapStartTime) <=options.doubleTapThreshold));
}
function inDoubleTap(){
return validateDoubleTap();
}
function validateTap(){
return ((fingerCount===1||!SUPPORTS_TOUCH)&&(isNaN(distance)||distance < options.threshold));
}
function validateLongTap(){
return ((duration > options.longTapThreshold)&&(distance < DOUBLE_TAP_THRESHOLD));
}
function didTap(){
return !!(validateTap()&&hasTap());
}
function didDoubleTap(){
return !!(validateDoubleTap()&&hasDoubleTap());
}
function didLongTap(){
return !!(validateLongTap()&&hasLongTap());
}
function startMultiFingerRelease(){
previousTouchEndTime=getTimeStamp();
previousTouchFingerCount=event.touches.length+1;
}
function cancelMultiFingerRelease(){
previousTouchEndTime=0;
previousTouchFingerCount=0;
};
function inMultiFingerRelease(){
var withinThreshold=false;
if(previousTouchEndTime){
var diff=getTimeStamp() - previousTouchEndTime;
if(diff<=options.fingerReleaseThreshold){
withinThreshold=true;
};};
return withinThreshold;
};
function getTouchInProgress(){
return !!($element.data(PLUGIN_NS+'_intouch')===true);
}
function setTouchInProgress(val){
if(val===true){
$element.bind(MOVE_EV, touchMove);
$element.bind(END_EV, touchEnd);
if(LEAVE_EV){
$element.bind(LEAVE_EV, touchLeave);
}}else{
$element.unbind(MOVE_EV, touchMove, false);
$element.unbind(END_EV, touchEnd, false);
if(LEAVE_EV){
$element.unbind(LEAVE_EV, touchLeave, false);
}}
$element.data(PLUGIN_NS+'_intouch', val===true);
}
function createFingerData(index, evt){
var id=evt.identifier!==undefined ? evt.identifier:0;
fingerData[index].identifier=id;
fingerData[index].start.x=fingerData[index].end.x=evt.pageX||evt.clientX;
fingerData[index].start.y=fingerData[index].end.y=evt.pageY||evt.clientY;
return fingerData[index];
}
function updateFingerData(evt){
var id=evt.identifier!==undefined ? evt.identifier:0;
var f=getFingerData(id);
f.end.x=evt.pageX||evt.clientX;
f.end.y=evt.pageY||evt.clientY;
return f;
}
function getFingerData(id){
for(var i=0; i=0)){
return LEFT;
}else if((angle <=360)&&(angle >=315)){
return LEFT;
}else if((angle >=135)&&(angle <=225)){
return RIGHT;
}else if((angle > 45)&&(angle < 135)){
return DOWN;
}else{
return UP;
}}
function getTimeStamp(){
var now=new Date();
return now.getTime();
}
function getbounds(el){
el=$(el);
var offset=el.offset();
var bounds={
left:offset.left,
right:offset.left+el.outerWidth(),
top:offset.top,
bottom:offset.top+el.outerHeight()
};
return bounds;
}
function isInBounds(point, bounds){
return (point.x > bounds.left&&point.x < bounds.right&&point.y > bounds.top&&point.y < bounds.bottom);
};}
}));
(function($){
if($.fn.carouFredSel){
return;
}
$.fn.caroufredsel=$.fn.carouFredSel=function(options, configs){
if(this.length==0){
debug(true, 'No element found for "' + this.selector + '".');
return this;
}
if(this.length > 1){
return this.each(function(){
$(this).carouFredSel(options, configs);
});
}
var $cfs=this,
$tt0=this[0],
starting_position=false;
if($cfs.data('_cfs_isCarousel')){
starting_position=$cfs.triggerHandler('_cfs_triggerEvent', 'currentPosition');
$cfs.trigger('_cfs_triggerEvent', ['destroy', true]);
}
var FN={};
FN._init=function(o, setOrig, start){
o=go_getObject($tt0, o);
o.items=go_getItemsObject($tt0, o.items);
o.scroll=go_getScrollObject($tt0, o.scroll);
o.auto=go_getAutoObject($tt0, o.auto);
o.prev=go_getPrevNextObject($tt0, o.prev);
o.next=go_getPrevNextObject($tt0, o.next);
o.pagination=go_getPaginationObject($tt0, o.pagination);
o.swipe=go_getSwipeObject($tt0, o.swipe);
o.mousewheel=go_getMousewheelObject($tt0, o.mousewheel);
if(setOrig){
opts_orig=$.extend(true, {}, $.fn.carouFredSel.defaults, o);
}
opts=$.extend(true, {}, $.fn.carouFredSel.defaults, o);
opts.d=cf_getDimensions(opts);
crsl.direction=(opts.direction=='up'||opts.direction=='left') ? 'next':'prev';
var a_itm=$cfs.children(),
avail_primary=ms_getParentSize($wrp, opts, 'width');
if(is_true(opts.cookie)){
opts.cookie='caroufredsel_cookie_' + conf.serialNumber;
}
opts.maxDimension=ms_getMaxDimension(opts, avail_primary);
opts.items=in_complementItems(opts.items, opts, a_itm, start);
opts[opts.d['width']]=in_complementPrimarySize(opts[opts.d['width']], opts, a_itm);
opts[opts.d['height']]=in_complementSecondarySize(opts[opts.d['height']], opts, a_itm);
if(opts.responsive){
if(!is_percentage(opts[opts.d['width']])){
opts[opts.d['width']]='100%';
}}
if(is_percentage(opts[opts.d['width']])){
crsl.upDateOnWindowResize=true;
crsl.primarySizePercentage=opts[opts.d['width']];
opts[opts.d['width']]=ms_getPercentage(avail_primary, crsl.primarySizePercentage);
if(!opts.items.visible){
opts.items.visibleConf.variable=true;
}}
if(opts.responsive){
opts.usePadding=false;
opts.padding=[0, 0, 0, 0];
opts.align=false;
opts.items.visibleConf.variable=false;
}else{
if(!opts.items.visible){
opts=in_complementVisibleItems(opts, avail_primary);
}
if(!opts[opts.d['width']]){
if(!opts.items.visibleConf.variable&&is_number(opts.items[opts.d['width']])&&opts.items.filter=='*'){
opts[opts.d['width']]=opts.items.visible * opts.items[opts.d['width']];
opts.align=false;
}else{
opts[opts.d['width']]='variable';
}}
if(is_undefined(opts.align)){
opts.align=(is_number(opts[opts.d['width']]))
? 'center'
: false;
}
if(opts.items.visibleConf.variable){
opts.items.visible=gn_getVisibleItemsNext(a_itm, opts, 0);
}}
if(opts.items.filter!='*'&&!opts.items.visibleConf.variable){
opts.items.visibleConf.org=opts.items.visible;
opts.items.visible=gn_getVisibleItemsNextFilter(a_itm, opts, 0);
}
opts.items.visible=cf_getItemsAdjust(opts.items.visible, opts, opts.items.visibleConf.adjust, $tt0);
opts.items.visibleConf.old=opts.items.visible;
if(opts.responsive){
if(!opts.items.visibleConf.min){
opts.items.visibleConf.min=opts.items.visible;
}
if(!opts.items.visibleConf.max){
opts.items.visibleConf.max=opts.items.visible;
}
opts=in_getResponsiveValues(opts, a_itm, avail_primary);
}else{
opts.padding=cf_getPadding(opts.padding);
if(opts.align=='top'){
opts.align='left';
}
else if(opts.align=='bottom'){
opts.align='right';
}
switch (opts.align){
case 'center':
case 'left':
case 'right':
if(opts[opts.d['width']]!='variable'){
opts=in_getAlignPadding(opts, a_itm);
opts.usePadding=true;
}
break;
default:
opts.align=false;
opts.usePadding=(
opts.padding[0]==0 &&
opts.padding[1]==0 &&
opts.padding[2]==0 &&
opts.padding[3]==0
) ? false:true;
break;
}}
if(!is_number(opts.scroll.duration)){
opts.scroll.duration=500;
}
if(is_undefined(opts.scroll.items)){
opts.scroll.items=(opts.responsive||opts.items.visibleConf.variable||opts.items.filter!='*')
? 'visible'
: opts.items.visible;
}
opts.auto=$.extend(true, {}, opts.scroll, opts.auto);
opts.prev=$.extend(true, {}, opts.scroll, opts.prev);
opts.next=$.extend(true, {}, opts.scroll, opts.next);
opts.pagination=$.extend(true, {}, opts.scroll, opts.pagination);
opts.auto=go_complementAutoObject($tt0, opts.auto);
opts.prev=go_complementPrevNextObject($tt0, opts.prev);
opts.next=go_complementPrevNextObject($tt0, opts.next);
opts.pagination=go_complementPaginationObject($tt0, opts.pagination);
opts.swipe=go_complementSwipeObject($tt0, opts.swipe);
opts.mousewheel=go_complementMousewheelObject($tt0, opts.mousewheel);
if(opts.synchronise){
opts.synchronise=cf_getSynchArr(opts.synchronise);
}
if(opts.auto.onPauseStart){
opts.auto.onTimeoutStart=opts.auto.onPauseStart;
deprecated('auto.onPauseStart', 'auto.onTimeoutStart');
}
if(opts.auto.onPausePause){
opts.auto.onTimeoutPause=opts.auto.onPausePause;
deprecated('auto.onPausePause', 'auto.onTimeoutPause');
}
if(opts.auto.onPauseEnd){
opts.auto.onTimeoutEnd=opts.auto.onPauseEnd;
deprecated('auto.onPauseEnd', 'auto.onTimeoutEnd');
}
if(opts.auto.pauseDuration){
opts.auto.timeoutDuration=opts.auto.pauseDuration;
deprecated('auto.pauseDuration', 'auto.timeoutDuration');
}};
FN._build=function(){
$cfs.data('_cfs_isCarousel', true);
var a_itm=$cfs.children(),
orgCSS=in_mapCss($cfs, ['textAlign', 'float', 'position', 'top', 'right', 'bottom', 'left', 'zIndex', 'width', 'height', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft']),
newPosition='relative';
switch (orgCSS.position){
case 'absolute':
case 'fixed':
newPosition=orgCSS.position;
break;
}
if(conf.wrapper=='parent'){
sz_storeOrigCss($wrp);
}else{
$wrp.css(orgCSS);
}
$wrp.css({
'overflow':'hidden',
'position':newPosition
});
sz_storeOrigCss($cfs);
$cfs.data('_cfs_origCssZindex', orgCSS.zIndex);
$cfs.css({
'textAlign':'left',
'float':'none',
'position':'absolute',
'top':0,
'right':'auto',
'bottom':'auto',
'left':0,
'marginTop':0,
'marginRight':0,
'marginBottom':0,
'marginLeft':0
});
sz_storeMargin(a_itm, opts);
sz_storeOrigCss(a_itm);
if(opts.responsive){
sz_setResponsiveSizes(opts, a_itm);
}};
FN._bind_events=function(){
FN._unbind_events();
$cfs.bind(cf_e('stop', conf), function(e, imm){
e.stopPropagation();
if(!crsl.isStopped){
if(opts.auto.button){
opts.auto.button.addClass(cf_c('stopped', conf));
}}
crsl.isStopped=true;
if(opts.auto.play){
opts.auto.play=false;
$cfs.trigger(cf_e('pause', conf), imm);
}
return true;
});
$cfs.bind(cf_e('finish', conf), function(e){
e.stopPropagation();
if(crsl.isScrolling){
sc_stopScroll(scrl);
}
return true;
});
$cfs.bind(cf_e('pause', conf), function(e, imm, res){
e.stopPropagation();
tmrs=sc_clearTimers(tmrs);
if(imm&&crsl.isScrolling){
scrl.isStopped=true;
var nst=getTime() - scrl.startTime;
scrl.duration -=nst;
if(scrl.pre){
scrl.pre.duration -=nst;
}
if(scrl.post){
scrl.post.duration -=nst;
}
sc_stopScroll(scrl, false);
}
if(!crsl.isPaused&&!crsl.isScrolling){
if(res){
tmrs.timePassed +=getTime() - tmrs.startTime;
}}
if(!crsl.isPaused){
if(opts.auto.button){
opts.auto.button.addClass(cf_c('paused', conf));
}}
crsl.isPaused=true;
if(opts.auto.onTimeoutPause){
var dur1=opts.auto.timeoutDuration - tmrs.timePassed,
perc=100 - Math.ceil(dur1 * 100 / opts.auto.timeoutDuration);
opts.auto.onTimeoutPause.call($tt0, perc, dur1);
}
return true;
});
$cfs.bind(cf_e('play', conf), function(e, dir, del, res){
e.stopPropagation();
tmrs=sc_clearTimers(tmrs);
var v=[dir, del, res],
t=['string', 'number', 'boolean'],
a=cf_sortParams(v, t);
dir=a[0];
del=a[1];
res=a[2];
if(dir!='prev'&&dir!='next'){
dir=crsl.direction;
}
if(!is_number(del)){
del=0;
}
if(!is_boolean(res)){
res=false;
}
if(res){
crsl.isStopped=false;
opts.auto.play=true;
}
if(!opts.auto.play){
e.stopImmediatePropagation();
return debug(conf, 'Carousel stopped: Not scrolling.');
}
if(crsl.isPaused){
if(opts.auto.button){
opts.auto.button.removeClass(cf_c('stopped', conf));
opts.auto.button.removeClass(cf_c('paused', conf));
}}
crsl.isPaused=false;
tmrs.startTime=getTime();
var dur1=opts.auto.timeoutDuration + del;
dur2=dur1 - tmrs.timePassed;
perc=100 - Math.ceil(dur2 * 100 / dur1);
if(opts.auto.progress){
tmrs.progress=setInterval(function(){
var pasd=getTime() - tmrs.startTime + tmrs.timePassed,
perc=Math.ceil(pasd * 100 / dur1);
opts.auto.progress.updater.call(opts.auto.progress.bar[0], perc);
}, opts.auto.progress.interval);
}
tmrs.auto=setTimeout(function(){
if(opts.auto.progress){
opts.auto.progress.updater.call(opts.auto.progress.bar[0], 100);
}
if(opts.auto.onTimeoutEnd){
opts.auto.onTimeoutEnd.call($tt0, perc, dur2);
}
if(crsl.isScrolling){
$cfs.trigger(cf_e('play', conf), dir);
}else{
$cfs.trigger(cf_e(dir, conf), opts.auto);
}}, dur2);
if(opts.auto.onTimeoutStart){
opts.auto.onTimeoutStart.call($tt0, perc, dur2);
}
return true;
});
$cfs.bind(cf_e('resume', conf), function(e){
e.stopPropagation();
if(scrl.isStopped){
scrl.isStopped=false;
crsl.isPaused=false;
crsl.isScrolling=true;
scrl.startTime=getTime();
sc_startScroll(scrl, conf);
}else{
$cfs.trigger(cf_e('play', conf));
}
return true;
});
$cfs.bind(cf_e('prev', conf)+' '+cf_e('next', conf), function(e, obj, num, clb, que){
e.stopPropagation();
if(crsl.isStopped||$cfs.is(':hidden')){
e.stopImmediatePropagation();
return debug(conf, 'Carousel stopped or hidden: Not scrolling.');
}
var minimum=(is_number(opts.items.minimum)) ? opts.items.minimum:opts.items.visible + 1;
if(minimum > itms.total){
e.stopImmediatePropagation();
return debug(conf, 'Not enough items ('+itms.total+' total, '+minimum+' needed): Not scrolling.');
}
var v=[obj, num, clb, que],
t=['object', 'number/string', 'function', 'boolean'],
a=cf_sortParams(v, t);
obj=a[0];
num=a[1];
clb=a[2];
que=a[3];
var eType=e.type.slice(conf.events.prefix.length);
if(!is_object(obj)){
obj={};}
if(is_function(clb)){
obj.onAfter=clb;
}
if(is_boolean(que)){
obj.queue=que;
}
obj=$.extend(true, {}, opts[eType], obj);
if(obj.conditions&&!obj.conditions.call($tt0, eType)){
e.stopImmediatePropagation();
return debug(conf, 'Callback "conditions" returned false.');
}
if(!is_number(num)){
if(opts.items.filter!='*'){
num='visible';
}else{
var arr=[num, obj.items, opts[eType].items];
for (var a=0, l=arr.length; a < l; a++){
if(is_number(arr[a])||arr[a]=='page'||arr[a]=='visible'){
num=arr[a];
break;
}}
}
switch(num){
case 'page':
e.stopImmediatePropagation();
return $cfs.triggerHandler(cf_e(eType+'Page', conf), [obj, clb]);
break;
case 'visible':
if(!opts.items.visibleConf.variable&&opts.items.filter=='*'){
num=opts.items.visible;
}
break;
}}
if(scrl.isStopped){
$cfs.trigger(cf_e('resume', conf));
$cfs.trigger(cf_e('queue', conf), [eType, [obj, num, clb]]);
e.stopImmediatePropagation();
return debug(conf, 'Carousel resumed scrolling.');
}
if(obj.duration > 0){
if(crsl.isScrolling){
if(obj.queue){
if(obj.queue=='last'){
queu=[];
}
if(obj.queue!='first'||queu.length==0){
$cfs.trigger(cf_e('queue', conf), [eType, [obj, num, clb]]);
}}
e.stopImmediatePropagation();
return debug(conf, 'Carousel currently scrolling.');
}}
tmrs.timePassed=0;
$cfs.trigger(cf_e('slide_'+eType, conf), [obj, num]);
if(opts.synchronise){
var s=opts.synchronise,
c=[obj, num];
for (var j=0, l=s.length; j < l; j++){
var d=eType;
if(!s[j][2]){
d=(d=='prev') ? 'next':'prev';
}
if(!s[j][1]){
c[0]=s[j][0].triggerHandler('_cfs_triggerEvent', ['configuration', d]);
}
c[1]=num + s[j][3];
s[j][0].trigger('_cfs_triggerEvent', ['slide_'+d, c]);
}}
return true;
});
$cfs.bind(cf_e('slide_prev', conf), function(e, sO, nI){
e.stopPropagation();
var a_itm=$cfs.children();
if(!opts.circular){
if(itms.first==0){
if(opts.infinite){
$cfs.trigger(cf_e('next', conf), itms.total-1);
}
return e.stopImmediatePropagation();
}}
sz_resetMargin(a_itm, opts);
if(!is_number(nI)){
if(opts.items.visibleConf.variable){
nI=gn_getVisibleItemsPrev(a_itm, opts, itms.total-1);
}
else if(opts.items.filter!='*'){
var xI=(is_number(sO.items)) ? sO.items:gn_getVisibleOrg($cfs, opts);
nI=gn_getScrollItemsPrevFilter(a_itm, opts, itms.total-1, xI);
}else{
nI=opts.items.visible;
}
nI=cf_getAdjust(nI, opts, sO.items, $tt0);
}
if(!opts.circular){
if(itms.total - nI < itms.first){
nI=itms.total - itms.first;
}}
opts.items.visibleConf.old=opts.items.visible;
if(opts.items.visibleConf.variable){
var vI=cf_getItemsAdjust(gn_getVisibleItemsNext(a_itm, opts, itms.total-nI), opts, opts.items.visibleConf.adjust, $tt0);
if(opts.items.visible+nI <=vI&&nI < itms.total){
nI++;
vI=cf_getItemsAdjust(gn_getVisibleItemsNext(a_itm, opts, itms.total-nI), opts, opts.items.visibleConf.adjust, $tt0);
}
opts.items.visible=vI;
}
else if(opts.items.filter!='*'){
var vI=gn_getVisibleItemsNextFilter(a_itm, opts, itms.total-nI);
opts.items.visible=cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0);
}
sz_resetMargin(a_itm, opts, true);
if(nI==0){
e.stopImmediatePropagation();
return debug(conf, '0 items to scroll: Not scrolling.');
}
debug(conf, 'Scrolling '+nI+' items backward.');
itms.first +=nI;
while (itms.first >=itms.total){
itms.first -=itms.total;
}
if(!opts.circular){
if(itms.first==0&&sO.onEnd){
sO.onEnd.call($tt0, 'prev');
}
if(!opts.infinite){
nv_enableNavi(opts, itms.first, conf);
}}
$cfs.children().slice(itms.total-nI, itms.total).prependTo($cfs);
if(itms.total < opts.items.visible + nI){
$cfs.children().slice(0, (opts.items.visible+nI)-itms.total).clone(true).appendTo($cfs);
}
var a_itm=$cfs.children(),
i_old=gi_getOldItemsPrev(a_itm, opts, nI),
i_new=gi_getNewItemsPrev(a_itm, opts),
i_cur_l=a_itm.eq(nI-1),
i_old_l=i_old.last(),
i_new_l=i_new.last();
sz_resetMargin(a_itm, opts);
var pL=0,
pR=0;
if(opts.align){
var p=cf_getAlignPadding(i_new, opts);
pL=p[0];
pR=p[1];
}
var oL=(pL < 0) ? opts.padding[opts.d[3]]:0;
var hiddenitems=false,
i_skp=$();
if(opts.items.visible < nI){
i_skp=a_itm.slice(opts.items.visibleConf.old, nI);
if(sO.fx=='directscroll'){
var orgW=opts.items[opts.d['width']];
hiddenitems=i_skp;
i_cur_l=i_new_l;
sc_hideHiddenItems(hiddenitems);
opts.items[opts.d['width']]='variable';
}}
var $cf2=false,
i_siz=ms_getTotalSize(a_itm.slice(0, nI), opts, 'width'),
w_siz=cf_mapWrapperSizes(ms_getSizes(i_new, opts, true), opts, !opts.usePadding),
i_siz_vis=0,
a_cfs={},
a_wsz={},
a_cur={},
a_old={},
a_new={},
a_lef={},
a_lef_vis={},
a_dur=sc_getDuration(sO, opts, nI, i_siz);
switch(sO.fx){
case 'cover':
case 'cover-fade':
i_siz_vis=ms_getTotalSize(a_itm.slice(0, opts.items.visible), opts, 'width');
break;
}
if(hiddenitems){
opts.items[opts.d['width']]=orgW;
}
sz_resetMargin(a_itm, opts, true);
if(pR >=0){
sz_resetMargin(i_old_l, opts, opts.padding[opts.d[1]]);
}
if(pL >=0){
sz_resetMargin(i_cur_l, opts, opts.padding[opts.d[3]]);
}
if(opts.align){
opts.padding[opts.d[1]]=pR;
opts.padding[opts.d[3]]=pL;
}
a_lef[opts.d['left']]=-(i_siz - oL);
a_lef_vis[opts.d['left']]=-(i_siz_vis - oL);
a_wsz[opts.d['left']]=w_siz[opts.d['width']];
var _s_wrapper=function(){},
_a_wrapper=function(){},
_s_paddingold=function(){},
_a_paddingold=function(){},
_s_paddingnew=function(){},
_a_paddingnew=function(){},
_s_paddingcur=function(){},
_a_paddingcur=function(){},
_onafter=function(){},
_moveitems=function(){},
_position=function(){};
switch(sO.fx){
case 'crossfade':
case 'cover':
case 'cover-fade':
case 'uncover':
case 'uncover-fade':
$cf2=$cfs.clone(true).appendTo($wrp);
break;
}
switch(sO.fx){
case 'crossfade':
case 'uncover':
case 'uncover-fade':
$cf2.children().slice(0, nI).remove();
$cf2.children().slice(opts.items.visibleConf.old).remove();
break;
case 'cover':
case 'cover-fade':
$cf2.children().slice(opts.items.visible).remove();
$cf2.css(a_lef_vis);
break;
}
$cfs.css(a_lef);
scrl=sc_setScroll(a_dur, sO.easing, conf);
a_cfs[opts.d['left']]=(opts.usePadding) ? opts.padding[opts.d[3]]:0;
if(opts['centerVertically']){
a_cfs['line-height']=w_siz['height'] + 'px';
}
if(opts[opts.d['width']]=='variable'||opts[opts.d['height']]=='variable'){
_s_wrapper=function(){
$wrp.css(w_siz);
};
_a_wrapper=function(){
scrl.anims.push([$wrp, w_siz]);
};}
if(opts.usePadding){
if(i_new_l.not(i_cur_l).length){
a_cur[opts.d['marginRight']]=i_cur_l.data('_cfs_origCssMargin');
if(pL < 0){
i_cur_l.css(a_cur);
}else{
_s_paddingcur=function(){
i_cur_l.css(a_cur);
};
_a_paddingcur=function(){
scrl.anims.push([i_cur_l, a_cur]);
};}}
switch(sO.fx){
case 'cover':
case 'cover-fade':
$cf2.children().eq(nI-1).css(a_cur);
break;
}
if(i_new_l.not(i_old_l).length){
a_old[opts.d['marginRight']]=i_old_l.data('_cfs_origCssMargin');
_s_paddingold=function(){
i_old_l.css(a_old);
};
_a_paddingold=function(){
scrl.anims.push([i_old_l, a_old]);
};}
if(pR >=0){
a_new[opts.d['marginRight']]=i_new_l.data('_cfs_origCssMargin') + opts.padding[opts.d[1]];
_s_paddingnew=function(){
i_new_l.css(a_new);
};
_a_paddingnew=function(){
scrl.anims.push([i_new_l, a_new]);
};}}
_position=function(){
$cfs.css(a_cfs);
};
var overFill=opts.items.visible+nI-itms.total;
_moveitems=function(){
if(overFill > 0){
$cfs.children().slice(itms.total).remove();
i_old=$($cfs.children().slice(itms.total-(opts.items.visible-overFill)).get().concat($cfs.children().slice(0, overFill).get()));
}
sc_showHiddenItems(hiddenitems);
if(opts.usePadding){
var l_itm=$cfs.children().eq(opts.items.visible+nI-1);
l_itm.css(opts.d['marginRight'], l_itm.data('_cfs_origCssMargin'));
}};
var cb_arguments=sc_mapCallbackArguments(i_old, i_skp, i_new, nI, 'prev', a_dur, w_siz);
_onafter=function(){
sc_afterScroll($cfs, $cf2, sO);
crsl.isScrolling=false;
clbk.onAfter=sc_fireCallbacks($tt0, sO, 'onAfter', cb_arguments, clbk);
queu=sc_fireQueue($cfs, queu, conf);
if(!crsl.isPaused){
$cfs.trigger(cf_e('play', conf));
}};
crsl.isScrolling=true;
tmrs=sc_clearTimers(tmrs);
clbk.onBefore=sc_fireCallbacks($tt0, sO, 'onBefore', cb_arguments, clbk);
switch(sO.fx){
case 'none':
$cfs.css(a_cfs);
_s_wrapper();
_s_paddingold();
_s_paddingnew();
_s_paddingcur();
_position();
_moveitems();
_onafter();
break;
case 'fade':
scrl.anims.push([$cfs, { 'opacity': 0 }, function(){
_s_wrapper();
_s_paddingold();
_s_paddingnew();
_s_paddingcur();
_position();
_moveitems();
scrl=sc_setScroll(a_dur, sO.easing, conf);
scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]);
sc_startScroll(scrl, conf);
}]);
break;
case 'crossfade':
$cfs.css({ 'opacity': 0 });
scrl.anims.push([$cf2, { 'opacity': 0 }]);
scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]);
_a_wrapper();
_s_paddingold();
_s_paddingnew();
_s_paddingcur();
_position();
_moveitems();
break;
case 'cover':
scrl.anims.push([$cf2, a_cfs, function(){
_s_paddingold();
_s_paddingnew();
_s_paddingcur();
_position();
_moveitems();
_onafter();
}]);
_a_wrapper();
break;
case 'cover-fade':
scrl.anims.push([$cfs, { 'opacity': 0 }]);
scrl.anims.push([$cf2, a_cfs, function(){
_s_paddingold();
_s_paddingnew();
_s_paddingcur();
_position();
_moveitems();
_onafter();
}]);
_a_wrapper();
break;
case 'uncover':
scrl.anims.push([$cf2, a_wsz, _onafter]);
_a_wrapper();
_s_paddingold();
_s_paddingnew();
_s_paddingcur();
_position();
_moveitems();
break;
case 'uncover-fade':
$cfs.css({ 'opacity': 0 });
scrl.anims.push([$cfs, { 'opacity': 1 }]);
scrl.anims.push([$cf2, a_wsz, _onafter]);
_a_wrapper();
_s_paddingold();
_s_paddingnew();
_s_paddingcur();
_position();
_moveitems();
break;
default:
scrl.anims.push([$cfs, a_cfs, function(){
_moveitems();
_onafter();
}]);
_a_wrapper();
_a_paddingold();
_a_paddingnew();
_a_paddingcur();
break;
}
sc_startScroll(scrl, conf);
cf_setCookie(opts.cookie, $cfs, conf);
$cfs.trigger(cf_e('updatePageStatus', conf), [false, w_siz]);
return true;
});
$cfs.bind(cf_e('slide_next', conf), function(e, sO, nI){
e.stopPropagation();
var a_itm=$cfs.children();
if(!opts.circular){
if(itms.first==opts.items.visible){
if(opts.infinite){
$cfs.trigger(cf_e('prev', conf), itms.total-1);
}
return e.stopImmediatePropagation();
}}
sz_resetMargin(a_itm, opts);
if(!is_number(nI)){
if(opts.items.filter!='*'){
var xI=(is_number(sO.items)) ? sO.items:gn_getVisibleOrg($cfs, opts);
nI=gn_getScrollItemsNextFilter(a_itm, opts, 0, xI);
}else{
nI=opts.items.visible;
}
nI=cf_getAdjust(nI, opts, sO.items, $tt0);
}
var lastItemNr=(itms.first==0) ? itms.total:itms.first;
if(!opts.circular){
if(opts.items.visibleConf.variable){
var vI=gn_getVisibleItemsNext(a_itm, opts, nI),
xI=gn_getVisibleItemsPrev(a_itm, opts, lastItemNr-1);
}else{
var vI=opts.items.visible,
xI=opts.items.visible;
}
if(nI + vI > lastItemNr){
nI=lastItemNr - xI;
}}
opts.items.visibleConf.old=opts.items.visible;
if(opts.items.visibleConf.variable){
var vI=cf_getItemsAdjust(gn_getVisibleItemsNextTestCircular(a_itm, opts, nI, lastItemNr), opts, opts.items.visibleConf.adjust, $tt0);
while (opts.items.visible-nI >=vI&&nI < itms.total){
nI++;
vI=cf_getItemsAdjust(gn_getVisibleItemsNextTestCircular(a_itm, opts, nI, lastItemNr), opts, opts.items.visibleConf.adjust, $tt0);
}
opts.items.visible=vI;
}
else if(opts.items.filter!='*'){
var vI=gn_getVisibleItemsNextFilter(a_itm, opts, nI);
opts.items.visible=cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0);
}
sz_resetMargin(a_itm, opts, true);
if(nI==0){
e.stopImmediatePropagation();
return debug(conf, '0 items to scroll: Not scrolling.');
}
debug(conf, 'Scrolling '+nI+' items forward.');
itms.first -=nI;
while (itms.first < 0){
itms.first +=itms.total;
}
if(!opts.circular){
if(itms.first==opts.items.visible&&sO.onEnd){
sO.onEnd.call($tt0, 'next');
}
if(!opts.infinite){
nv_enableNavi(opts, itms.first, conf);
}}
if(itms.total < opts.items.visible+nI){
$cfs.children().slice(0, (opts.items.visible+nI)-itms.total).clone(true).appendTo($cfs);
}
var a_itm=$cfs.children(),
i_old=gi_getOldItemsNext(a_itm, opts),
i_new=gi_getNewItemsNext(a_itm, opts, nI),
i_cur_l=a_itm.eq(nI-1),
i_old_l=i_old.last(),
i_new_l=i_new.last();
sz_resetMargin(a_itm, opts);
var pL=0,
pR=0;
if(opts.align){
var p=cf_getAlignPadding(i_new, opts);
pL=p[0];
pR=p[1];
}
var hiddenitems=false,
i_skp=$();
if(opts.items.visibleConf.old < nI){
i_skp=a_itm.slice(opts.items.visibleConf.old, nI);
if(sO.fx=='directscroll'){
var orgW=opts.items[opts.d['width']];
hiddenitems=i_skp;
i_cur_l=i_old_l;
sc_hideHiddenItems(hiddenitems);
opts.items[opts.d['width']]='variable';
}}
var $cf2=false,
i_siz=ms_getTotalSize(a_itm.slice(0, nI), opts, 'width'),
w_siz=cf_mapWrapperSizes(ms_getSizes(i_new, opts, true), opts, !opts.usePadding),
i_siz_vis=0,
a_cfs={},
a_cfs_vis={},
a_cur={},
a_old={},
a_lef={},
a_dur=sc_getDuration(sO, opts, nI, i_siz);
switch(sO.fx){
case 'uncover':
case 'uncover-fade':
i_siz_vis=ms_getTotalSize(a_itm.slice(0, opts.items.visibleConf.old), opts, 'width');
break;
}
if(hiddenitems){
opts.items[opts.d['width']]=orgW;
}
if(opts.align){
if(opts.padding[opts.d[1]] < 0){
opts.padding[opts.d[1]]=0;
}}
sz_resetMargin(a_itm, opts, true);
sz_resetMargin(i_old_l, opts, opts.padding[opts.d[1]]);
if(opts.align){
opts.padding[opts.d[1]]=pR;
opts.padding[opts.d[3]]=pL;
}
a_lef[opts.d['left']]=(opts.usePadding) ? opts.padding[opts.d[3]]:0;
var _s_wrapper=function(){},
_a_wrapper=function(){},
_s_paddingold=function(){},
_a_paddingold=function(){},
_s_paddingcur=function(){},
_a_paddingcur=function(){},
_onafter=function(){},
_moveitems=function(){},
_position=function(){};
switch(sO.fx){
case 'crossfade':
case 'cover':
case 'cover-fade':
case 'uncover':
case 'uncover-fade':
$cf2=$cfs.clone(true).appendTo($wrp);
$cf2.children().slice(opts.items.visibleConf.old).remove();
break;
}
switch(sO.fx){
case 'crossfade':
case 'cover':
case 'cover-fade':
$cfs.css('zIndex', 1);
$cf2.css('zIndex', 0);
break;
}
scrl=sc_setScroll(a_dur, sO.easing, conf);
a_cfs[opts.d['left']]=-i_siz;
if(opts['centerVertically']){
a_cfs['line-height']=w_siz['height'] + 'px';
}
a_cfs_vis[opts.d['left']]=-i_siz_vis;
if(pL < 0){
a_cfs[opts.d['left']] +=pL;
}
if(opts[opts.d['width']]=='variable'||opts[opts.d['height']]=='variable'){
_s_wrapper=function(){
$wrp.css(w_siz);
};
_a_wrapper=function(){
scrl.anims.push([$wrp, w_siz]);
};}
if(opts.usePadding){
var i_new_l_m=i_new_l.data('_cfs_origCssMargin');
if(pR >=0){
i_new_l_m +=opts.padding[opts.d[1]];
}
i_new_l.css(opts.d['marginRight'], i_new_l_m);
if(i_cur_l.not(i_old_l).length){
a_old[opts.d['marginRight']]=i_old_l.data('_cfs_origCssMargin');
}
_s_paddingold=function(){
i_old_l.css(a_old);
};
_a_paddingold=function(){
scrl.anims.push([i_old_l, a_old]);
};
var i_cur_l_m=i_cur_l.data('_cfs_origCssMargin');
if(pL > 0){
i_cur_l_m +=opts.padding[opts.d[3]];
}
a_cur[opts.d['marginRight']]=i_cur_l_m;
_s_paddingcur=function(){
i_cur_l.css(a_cur);
};
_a_paddingcur=function(){
scrl.anims.push([i_cur_l, a_cur]);
};}
_position=function(){
$cfs.css(a_lef);
};
var overFill=opts.items.visible+nI-itms.total;
_moveitems=function(){
if(overFill > 0){
$cfs.children().slice(itms.total).remove();
}
var l_itm=$cfs.children().slice(0, nI).appendTo($cfs).last();
if(overFill > 0){
i_new=gi_getCurrentItems(a_itm, opts);
}
sc_showHiddenItems(hiddenitems);
if(opts.usePadding){
if(itms.total < opts.items.visible+nI){
var i_cur_l=$cfs.children().eq(opts.items.visible-1);
i_cur_l.css(opts.d['marginRight'], i_cur_l.data('_cfs_origCssMargin') + opts.padding[opts.d[1]]);
}
l_itm.css(opts.d['marginRight'], l_itm.data('_cfs_origCssMargin'));
}};
var cb_arguments=sc_mapCallbackArguments(i_old, i_skp, i_new, nI, 'next', a_dur, w_siz);
_onafter=function(){
$cfs.css('zIndex', $cfs.data('_cfs_origCssZindex'));
sc_afterScroll($cfs, $cf2, sO);
crsl.isScrolling=false;
clbk.onAfter=sc_fireCallbacks($tt0, sO, 'onAfter', cb_arguments, clbk);
queu=sc_fireQueue($cfs, queu, conf);
if(!crsl.isPaused){
$cfs.trigger(cf_e('play', conf));
}};
crsl.isScrolling=true;
tmrs=sc_clearTimers(tmrs);
clbk.onBefore=sc_fireCallbacks($tt0, sO, 'onBefore', cb_arguments, clbk);
switch(sO.fx){
case 'none':
$cfs.css(a_cfs);
_s_wrapper();
_s_paddingold();
_s_paddingcur();
_position();
_moveitems();
_onafter();
break;
case 'fade':
scrl.anims.push([$cfs, { 'opacity': 0 }, function(){
_s_wrapper();
_s_paddingold();
_s_paddingcur();
_position();
_moveitems();
scrl=sc_setScroll(a_dur, sO.easing, conf);
scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]);
sc_startScroll(scrl, conf);
}]);
break;
case 'crossfade':
$cfs.css({ 'opacity': 0 });
scrl.anims.push([$cf2, { 'opacity': 0 }]);
scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]);
_a_wrapper();
_s_paddingold();
_s_paddingcur();
_position();
_moveitems();
break;
case 'cover':
$cfs.css(opts.d['left'], $wrp[opts.d['width']]());
scrl.anims.push([$cfs, a_lef, _onafter]);
_a_wrapper();
_s_paddingold();
_s_paddingcur();
_moveitems();
break;
case 'cover-fade':
$cfs.css(opts.d['left'], $wrp[opts.d['width']]());
scrl.anims.push([$cf2, { 'opacity': 0 }]);
scrl.anims.push([$cfs, a_lef, _onafter]);
_a_wrapper();
_s_paddingold();
_s_paddingcur();
_moveitems();
break;
case 'uncover':
scrl.anims.push([$cf2, a_cfs_vis, _onafter]);
_a_wrapper();
_s_paddingold();
_s_paddingcur();
_position();
_moveitems();
break;
case 'uncover-fade':
$cfs.css({ 'opacity': 0 });
scrl.anims.push([$cfs, { 'opacity': 1 }]);
scrl.anims.push([$cf2, a_cfs_vis, _onafter]);
_a_wrapper();
_s_paddingold();
_s_paddingcur();
_position();
_moveitems();
break;
default:
scrl.anims.push([$cfs, a_cfs, function(){
_position();
_moveitems();
_onafter();
}]);
_a_wrapper();
_a_paddingold();
_a_paddingcur();
break;
}
sc_startScroll(scrl, conf);
cf_setCookie(opts.cookie, $cfs, conf);
$cfs.trigger(cf_e('updatePageStatus', conf), [false, w_siz]);
return true;
});
$cfs.bind(cf_e('slideTo', conf), function(e, num, dev, org, obj, dir, clb){
e.stopPropagation();
var v=[num, dev, org, obj, dir, clb],
t=['string/number/object', 'number', 'boolean', 'object', 'string', 'function'],
a=cf_sortParams(v, t);
obj=a[3];
dir=a[4];
clb=a[5];
num=gn_getItemIndex(a[0], a[1], a[2], itms, $cfs);
if(num==0){
return false;
}
if(!is_object(obj)){
obj=false;
}
if(dir!='prev'&&dir!='next'){
if(opts.circular){
dir=(num <=itms.total / 2) ? 'next':'prev';
}else{
dir=(itms.first==0||itms.first > num) ? 'next':'prev';
}}
if(dir=='prev'){
num=itms.total-num;
}
$cfs.trigger(cf_e(dir, conf), [obj, num, clb]);
return true;
});
$cfs.bind(cf_e('prevPage', conf), function(e, obj, clb){
e.stopPropagation();
var cur=$cfs.triggerHandler(cf_e('currentPage', conf));
return $cfs.triggerHandler(cf_e('slideToPage', conf), [cur-1, obj, 'prev', clb]);
});
$cfs.bind(cf_e('nextPage', conf), function(e, obj, clb){
e.stopPropagation();
var cur=$cfs.triggerHandler(cf_e('currentPage', conf));
return $cfs.triggerHandler(cf_e('slideToPage', conf), [cur+1, obj, 'next', clb]);
});
$cfs.bind(cf_e('slideToPage', conf), function(e, pag, obj, dir, clb){
e.stopPropagation();
if(!is_number(pag)){
pag=$cfs.triggerHandler(cf_e('currentPage', conf));
}
var ipp=opts.pagination.items||opts.items.visible,
max=Math.ceil(itms.total / ipp)-1;
if(pag < 0){
pag=max;
}
if(pag > max){
pag=0;
}
return $cfs.triggerHandler(cf_e('slideTo', conf), [pag*ipp, 0, true, obj, dir, clb]);
});
$cfs.bind(cf_e('jumpToStart', conf), function(e, s){
e.stopPropagation();
if(s){
s=gn_getItemIndex(s, 0, true, itms, $cfs);
}else{
s=0;
}
s +=itms.first;
if(s!=0){
if(itms.total > 0){
while (s > itms.total){
s -=itms.total;
}}
$cfs.prepend($cfs.children().slice(s, itms.total));
}
return true;
});
$cfs.bind(cf_e('synchronise', conf), function(e, s){
e.stopPropagation();
if(s){
s=cf_getSynchArr(s);
}
else if(opts.synchronise){
s=opts.synchronise;
}else{
return debug(conf, 'No carousel to synchronise.');
}
var n=$cfs.triggerHandler(cf_e('currentPosition', conf)),
x=true;
for (var j=0, l=s.length; j < l; j++){
if(!s[j][0].triggerHandler(cf_e('slideTo', conf), [n, s[j][3], true])){
x=false;
}}
return x;
});
$cfs.bind(cf_e('queue', conf), function(e, dir, opt){
e.stopPropagation();
if(is_function(dir)){
dir.call($tt0, queu);
}
else if(is_array(dir)){
queu=dir;
}
else if(!is_undefined(dir)){
queu.push([dir, opt]);
}
return queu;
});
$cfs.bind(cf_e('insertItem', conf), function(e, itm, num, org, dev){
e.stopPropagation();
var v=[itm, num, org, dev],
t=['string/object', 'string/number/object', 'boolean', 'number'],
a=cf_sortParams(v, t);
itm=a[0];
num=a[1];
org=a[2];
dev=a[3];
if(is_object(itm)&&!is_jquery(itm)){
itm=$(itm);
}
else if(is_string(itm)){
itm=$(itm);
}
if(!is_jquery(itm)||itm.length==0){
return debug(conf, 'Not a valid object.');
}
if(is_undefined(num)){
num='end';
}
sz_storeMargin(itm, opts);
sz_storeOrigCss(itm);
var orgNum=num,
before='before';
if(num=='end'){
if(org){
if(itms.first==0){
num=itms.total-1;
before='after';
}else{
num=itms.first;
itms.first +=itm.length;
}
if(num < 0){
num=0;
}}else{
num=itms.total-1;
before='after';
}}else{
num=gn_getItemIndex(num, dev, org, itms, $cfs);
}
var $cit=$cfs.children().eq(num);
if($cit.length){
$cit[before](itm);
}else{
debug(conf, 'Correct insert-position not found! Appending item to the end.');
$cfs.append(itm);
}
if(orgNum!='end'&&!org){
if(num < itms.first){
itms.first +=itm.length;
}}
itms.total=$cfs.children().length;
if(itms.first >=itms.total){
itms.first -=itms.total;
}
$cfs.trigger(cf_e('updateSizes', conf));
$cfs.trigger(cf_e('linkAnchors', conf));
return true;
});
$cfs.bind(cf_e('removeItem', conf), function(e, num, org, dev){
e.stopPropagation();
var v=[num, org, dev],
t=['string/number/object', 'boolean', 'number'],
a=cf_sortParams(v, t);
num=a[0];
org=a[1];
dev=a[2];
var removed=false;
if(num instanceof $&&num.length > 1){
$removed=$();
num.each(function(i, el){
var $rem=$cfs.trigger(cf_e('removeItem', conf), [$(this), org, dev]);
if($rem){
$removed=$removed.add($rem);
}});
return $removed;
}
if(is_undefined(num)||num=='end'){
$removed=$cfs.children().last();
}else{
num=gn_getItemIndex(num, dev, org, itms, $cfs);
var $removed=$cfs.children().eq(num);
if($removed.length){
if(num < itms.first){
itms.first -=$removed.length;
}}
}
if($removed&&$removed.length){
$removed.detach();
itms.total=$cfs.children().length;
$cfs.trigger(cf_e('updateSizes', conf));
}
return $removed;
});
$cfs.bind(cf_e('onBefore', conf)+' '+cf_e('onAfter', conf), function(e, fn){
e.stopPropagation();
var eType=e.type.slice(conf.events.prefix.length);
if(is_array(fn)){
clbk[eType]=fn;
}
if(is_function(fn)){
clbk[eType].push(fn);
}
return clbk[eType];
});
$cfs.bind(cf_e('currentPosition', conf), function(e, fn){
e.stopPropagation();
if(itms.first==0){
var val=0;
}else{
var val=itms.total - itms.first;
}
if(is_function(fn)){
fn.call($tt0, val);
}
return val;
});
$cfs.bind(cf_e('currentPage', conf), function(e, fn){
e.stopPropagation();
var ipp=opts.pagination.items||opts.items.visible,
max=Math.ceil(itms.total/ipp-1),
nr;
if(itms.first==0){
nr=0;
}
else if(itms.first < itms.total % ipp){
nr=0;
}
else if(itms.first==ipp&&!opts.circular){
nr=max;
}else{
nr=Math.round((itms.total-itms.first)/ipp);
}
if(nr < 0){
nr=0;
}
if(nr > max){
nr=max;
}
if(is_function(fn)){
fn.call($tt0, nr);
}
return nr;
});
$cfs.bind(cf_e('currentVisible', conf), function(e, fn){
e.stopPropagation();
var $i=gi_getCurrentItems($cfs.children(), opts);
if(is_function(fn)){
fn.call($tt0, $i);
}
return $i;
});
$cfs.bind(cf_e('slice', conf), function(e, f, l, fn){
e.stopPropagation();
if(itms.total==0){
return false;
}
var v=[f, l, fn],
t=['number', 'number', 'function'],
a=cf_sortParams(v, t);
f=(is_number(a[0])) ? a[0]:0;
l=(is_number(a[1])) ? a[1]:itms.total;
fn=a[2];
f +=itms.first;
l +=itms.first;
if(items.total > 0){
while (f > itms.total){
f -=itms.total;
}
while (l > itms.total){
l -=itms.total;
}
while (f < 0){
f +=itms.total;
}
while (l < 0){
l +=itms.total;
}}
var $iA=$cfs.children(),
$i;
if(l > f){
$i=$iA.slice(f, l);
}else{
$i=$($iA.slice(f, itms.total).get().concat($iA.slice(0, l).get()));
}
if(is_function(fn)){
fn.call($tt0, $i);
}
return $i;
});
$cfs.bind(cf_e('isPaused', conf)+' '+cf_e('isStopped', conf)+' '+cf_e('isScrolling', conf), function(e, fn){
e.stopPropagation();
var eType=e.type.slice(conf.events.prefix.length),
value=crsl[eType];
if(is_function(fn)){
fn.call($tt0, value);
}
return value;
});
$cfs.bind(cf_e('configuration', conf), function(e, a, b, c){
e.stopPropagation();
var reInit=false;
if(is_function(a)){
a.call($tt0, opts);
}
else if(is_object(a)){
opts_orig=$.extend(true, {}, opts_orig, a);
if(b!==false) reInit=true;
else opts=$.extend(true, {}, opts, a);
}
else if(!is_undefined(a)){
if(is_function(b)){
var val=eval('opts.'+a);
if(is_undefined(val)){
val='';
}
b.call($tt0, val);
}
else if(!is_undefined(b)){
if(typeof c!=='boolean') c=true;
eval('opts_orig.'+a+'=b');
if(c!==false) reInit=true;
else eval('opts.'+a+'=b');
}else{
return eval('opts.'+a);
}}
if(reInit){
sz_resetMargin($cfs.children(), opts);
FN._init(opts_orig);
FN._bind_buttons();
var sz=sz_setSizes($cfs, opts);
$cfs.trigger(cf_e('updatePageStatus', conf), [true, sz]);
}
return opts;
});
$cfs.bind(cf_e('linkAnchors', conf), function(e, $con, sel){
e.stopPropagation();
if(is_undefined($con)){
$con=$('body');
}
else if(is_string($con)){
$con=$($con);
}
if(!is_jquery($con)||$con.length==0){
return debug(conf, 'Not a valid object.');
}
if(!is_string(sel)){
sel='a.caroufredsel';
}
$con.find(sel).each(function(){
var h=this.hash||'';
if(h.length > 0&&$cfs.children().index($(h))!=-1){
$(this).unbind('click').click(function(e){
e.preventDefault();
$cfs.trigger(cf_e('slideTo', conf), h);
});
}});
return true;
});
$cfs.bind(cf_e('updatePageStatus', conf), function(e, build, sizes){
e.stopPropagation();
if(!opts.pagination.container){
return;
}
var ipp=opts.pagination.items||opts.items.visible,
pgs=Math.ceil(itms.total/ipp);
if(build){
if(opts.pagination.anchorBuilder){
opts.pagination.container.children().remove();
opts.pagination.container.each(function(){
for (var a=0; a < pgs; a++){
var i=$cfs.children().eq(gn_getItemIndex(a*ipp, 0, true, itms, $cfs));
$(this).append(opts.pagination.anchorBuilder.call(i[0], a+1));
}});
}
opts.pagination.container.each(function(){
$(this).children().unbind(opts.pagination.event).each(function(a){
$(this).bind(opts.pagination.event, function(e){
e.preventDefault();
$cfs.trigger(cf_e('slideTo', conf), [a*ipp, -opts.pagination.deviation, true, opts.pagination]);
});
});
});
}
var selected=$cfs.triggerHandler(cf_e('currentPage', conf)) + opts.pagination.deviation;
if(selected >=pgs){
selected=0;
}
if(selected < 0){
selected=pgs-1;
}
opts.pagination.container.each(function(){
$(this).children().removeClass(cf_c('selected', conf)).eq(selected).addClass(cf_c('selected', conf));
});
return true;
});
$cfs.bind(cf_e('updateSizes', conf), function(e){
var vI=opts.items.visible,
a_itm=$cfs.children(),
avail_primary=ms_getParentSize($wrp, opts, 'width');
itms.total=a_itm.length;
if(crsl.primarySizePercentage){
opts.maxDimension=avail_primary;
opts[opts.d['width']]=ms_getPercentage(avail_primary, crsl.primarySizePercentage);
}else{
opts.maxDimension=ms_getMaxDimension(opts, avail_primary);
}
if(opts.responsive){
opts.items.width=opts.items.sizesConf.width;
opts.items.height=opts.items.sizesConf.height;
opts=in_getResponsiveValues(opts, a_itm, avail_primary);
vI=opts.items.visible;
sz_setResponsiveSizes(opts, a_itm);
}
else if(opts.items.visibleConf.variable){
vI=gn_getVisibleItemsNext(a_itm, opts, 0);
}
else if(opts.items.filter!='*'){
vI=gn_getVisibleItemsNextFilter(a_itm, opts, 0);
}
if(!opts.circular&&itms.first!=0&&vI > itms.first){
if(opts.items.visibleConf.variable){
var nI=gn_getVisibleItemsPrev(a_itm, opts, itms.first) - itms.first;
}
else if(opts.items.filter!='*'){
var nI=gn_getVisibleItemsPrevFilter(a_itm, opts, itms.first) - itms.first;
}else{
var nI=opts.items.visible - itms.first;
}
debug(conf, 'Preventing non-circular: sliding '+nI+' items backward.');
$cfs.trigger(cf_e('prev', conf), nI);
}
opts.items.visible=cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0);
opts.items.visibleConf.old=opts.items.visible;
opts=in_getAlignPadding(opts, a_itm);
var sz=sz_setSizes($cfs, opts);
$cfs.trigger(cf_e('updatePageStatus', conf), [true, sz]);
nv_showNavi(opts, itms.total, conf);
nv_enableNavi(opts, itms.first, conf);
return sz;
});
$cfs.bind(cf_e('destroy', conf), function(e, orgOrder){
e.stopPropagation();
tmrs=sc_clearTimers(tmrs);
$cfs.data('_cfs_isCarousel', false);
$cfs.trigger(cf_e('finish', conf));
if(orgOrder){
$cfs.trigger(cf_e('jumpToStart', conf));
}
sz_restoreOrigCss($cfs.children());
sz_restoreOrigCss($cfs);
FN._unbind_events();
FN._unbind_buttons();
if(conf.wrapper=='parent'){
sz_restoreOrigCss($wrp);
}else{
$wrp.replaceWith($cfs);
}
return true;
});
$cfs.bind(cf_e('debug', conf), function(e){
debug(conf, 'Carousel width: ' + opts.width);
debug(conf, 'Carousel height: ' + opts.height);
debug(conf, 'Item widths: ' + opts.items.width);
debug(conf, 'Item heights: ' + opts.items.height);
debug(conf, 'Number of items visible: ' + opts.items.visible);
if(opts.auto.play){
debug(conf, 'Number of items scrolled automatically: ' + opts.auto.items);
}
if(opts.prev.button){
debug(conf, 'Number of items scrolled backward: ' + opts.prev.items);
}
if(opts.next.button){
debug(conf, 'Number of items scrolled forward: ' + opts.next.items);
}
return conf.debug;
});
$cfs.bind('_cfs_triggerEvent', function(e, n, o){
e.stopPropagation();
return $cfs.triggerHandler(cf_e(n, conf), o);
});
};
FN._unbind_events=function(){
$cfs.unbind(cf_e('', conf));
$cfs.unbind(cf_e('', conf, false));
$cfs.unbind('_cfs_triggerEvent');
};
FN._bind_buttons=function(){
FN._unbind_buttons();
nv_showNavi(opts, itms.total, conf);
nv_enableNavi(opts, itms.first, conf);
if(opts.auto.pauseOnHover){
var pC=bt_pauseOnHoverConfig(opts.auto.pauseOnHover);
$wrp.bind(cf_e('mouseenter', conf, false), function(){ $cfs.trigger(cf_e('pause', conf), pC); })
.bind(cf_e('mouseleave', conf, false), function(){ $cfs.trigger(cf_e('resume', conf)); });
}
if(opts.auto.button){
opts.auto.button.bind(cf_e(opts.auto.event, conf, false), function(e){
e.preventDefault();
var ev=false,
pC=null;
if(crsl.isPaused){
ev='play';
}
else if(opts.auto.pauseOnEvent){
ev='pause';
pC=bt_pauseOnHoverConfig(opts.auto.pauseOnEvent);
}
if(ev){
$cfs.trigger(cf_e(ev, conf), pC);
}});
}
if(opts.prev.button){
opts.prev.button.bind(cf_e(opts.prev.event, conf, false), function(e){
e.preventDefault();
$cfs.trigger(cf_e('prev', conf));
});
if(opts.prev.pauseOnHover){
var pC=bt_pauseOnHoverConfig(opts.prev.pauseOnHover);
opts.prev.button.bind(cf_e('mouseenter', conf, false), function(){ $cfs.trigger(cf_e('pause', conf), pC); })
.bind(cf_e('mouseleave', conf, false), function(){ $cfs.trigger(cf_e('resume', conf)); });
}}
if(opts.next.button){
opts.next.button.bind(cf_e(opts.next.event, conf, false), function(e){
e.preventDefault();
$cfs.trigger(cf_e('next', conf));
});
if(opts.next.pauseOnHover){
var pC=bt_pauseOnHoverConfig(opts.next.pauseOnHover);
opts.next.button.bind(cf_e('mouseenter', conf, false), function(){ $cfs.trigger(cf_e('pause', conf), pC); })
.bind(cf_e('mouseleave', conf, false), function(){ $cfs.trigger(cf_e('resume', conf)); });
}}
if(opts.pagination.container){
if(opts.pagination.pauseOnHover){
var pC=bt_pauseOnHoverConfig(opts.pagination.pauseOnHover);
opts.pagination.container.bind(cf_e('mouseenter', conf, false), function(){ $cfs.trigger(cf_e('pause', conf), pC); })
.bind(cf_e('mouseleave', conf, false), function(){ $cfs.trigger(cf_e('resume', conf)); });
}}
if(opts.prev.key||opts.next.key){
$(document).bind(cf_e('keyup', conf, false, true, true), function(e){
var k=e.keyCode;
if(k==opts.next.key){
e.preventDefault();
$cfs.trigger(cf_e('next', conf));
}
if(k==opts.prev.key){
e.preventDefault();
$cfs.trigger(cf_e('prev', conf));
}});
}
if(opts.pagination.keys){
$(document).bind(cf_e('keyup', conf, false, true, true), function(e){
var k=e.keyCode;
if(k >=49&&k < 58){
k=(k-49) * opts.items.visible;
if(k <=itms.total){
e.preventDefault();
$cfs.trigger(cf_e('slideTo', conf), [k, 0, true, opts.pagination]);
}}
});
}
if($.fn.swipe){
var isTouch='ontouchstart' in window;
if((isTouch&&opts.swipe.onTouch)||(!isTouch&&opts.swipe.onMouse)){
var scP=$.extend(true, {}, opts.prev, opts.swipe),
scN=$.extend(true, {}, opts.next, opts.swipe),
swP=function(){ $cfs.trigger(cf_e('prev', conf), [scP]) },
swN=function(){ $cfs.trigger(cf_e('next', conf), [scN]) };
switch (opts.direction){
case 'up':
case 'down':
opts.swipe.options.swipeUp=swN;
opts.swipe.options.swipeDown=swP;
break;
default:
opts.swipe.options.swipeLeft=swN;
opts.swipe.options.swipeRight=swP;
}
if(crsl.swipe){
$cfs.swipe('destroy');
}
$wrp.swipe(opts.swipe.options);
crsl.swipe=true;
}}
if($.fn.mousewheel){
if(opts.mousewheel){
var mcP=$.extend(true, {}, opts.prev, opts.mousewheel),
mcN=$.extend(true, {}, opts.next, opts.mousewheel);
if(crsl.mousewheel){
$wrp.unbind(cf_e('mousewheel', conf, false));
}
$wrp.bind(cf_e('mousewheel', conf, false), function(e, delta){
e.preventDefault();
if(delta > 0){
$cfs.trigger(cf_e('prev', conf), [mcP]);
}else{
$cfs.trigger(cf_e('next', conf), [mcN]);
}});
crsl.mousewheel=true;
}}
if(opts.auto.play){
$cfs.trigger(cf_e('play', conf), opts.auto.delay);
}
if(crsl.upDateOnWindowResize){
var resizeFn=function(e){
$cfs.trigger(cf_e('finish', conf));
if(opts.auto.pauseOnResize&&!crsl.isPaused){
$cfs.trigger(cf_e('play', conf));
}
sz_resetMargin($cfs.children(), opts);
$cfs.trigger(cf_e('updateSizes', conf));
};
var $w=$(window),
onResize=null;
if($.debounce&&conf.onWindowResize=='debounce'){
onResize=$.debounce(200, resizeFn);
}
else if($.throttle&&conf.onWindowResize=='throttle'){
onResize=$.throttle(300, resizeFn);
}else{
var _windowWidth=0,
_windowHeight=0;
onResize=function(){
var nw=$w.width(),
nh=$w.height();
if(nw!=_windowWidth||nh!=_windowHeight){
resizeFn();
_windowWidth=nw;
_windowHeight=nh;
}};}
$w.bind(cf_e('resize', conf, false, true, true), onResize);
}};
FN._unbind_buttons=function(){
var ns1=cf_e('', conf),
ns2=cf_e('', conf, false);
ns3=cf_e('', conf, false, true, true);
$(document).unbind(ns3);
$(window).unbind(ns3);
$wrp.unbind(ns2);
if(opts.auto.button){
opts.auto.button.unbind(ns2);
}
if(opts.prev.button){
opts.prev.button.unbind(ns2);
}
if(opts.next.button){
opts.next.button.unbind(ns2);
}
if(opts.pagination.container){
opts.pagination.container.unbind(ns2);
if(opts.pagination.anchorBuilder){
opts.pagination.container.children().remove();
}}
if(crsl.swipe){
$cfs.swipe('destroy');
$wrp.css('cursor', 'default');
crsl.swipe=false;
}
if(crsl.mousewheel){
crsl.mousewheel=false;
}
nv_showNavi(opts, 'hide', conf);
nv_enableNavi(opts, 'removeClass', conf);
};
if(is_boolean(configs)){
configs={
'debug': configs
};}
var crsl={
'direction':'next',
'isPaused':true,
'isScrolling':false,
'isStopped':false,
'mousewheel':false,
'swipe':false
},
itms={
'total':$cfs.children().length,
'first':0
},
tmrs={
'auto':null,
'progress':null,
'startTime':getTime(),
'timePassed':0
},
scrl={
'isStopped':false,
'duration':0,
'startTime':0,
'easing':'',
'anims':[]
},
clbk={
'onBefore':[],
'onAfter':[]
},
queu=[],
conf=$.extend(true, {}, $.fn.carouFredSel.configs, configs),
opts={},
opts_orig=$.extend(true, {}, options),
$wrp=(conf.wrapper=='parent')
? $cfs.parent()
: $cfs.wrap('<'+conf.wrapper.element+' class="'+conf.wrapper.classname+'" />').parent();
conf.selector=$cfs.selector;
conf.serialNumber=$.fn.carouFredSel.serialNumber++;
conf.transition=(conf.transition&&$.fn.transition) ? 'transition':'animate';
FN._init(opts_orig, true, starting_position);
FN._build();
FN._bind_events();
FN._bind_buttons();
if(is_array(opts.items.start)){
var start_arr=opts.items.start;
}else{
var start_arr=[];
if(opts.items.start!=0){
start_arr.push(opts.items.start);
}}
if(opts.cookie){
start_arr.unshift(parseInt(cf_getCookie(opts.cookie), 10));
}
if(start_arr.length > 0){
for (var a=0, l=start_arr.length; a < l; a++){
var s=start_arr[a];
if(s==0){
continue;
}
if(s===true){
s=window.location.hash;
if(s.length < 1){
continue;
}}
else if(s==='random'){
s=Math.floor(Math.random()*itms.total);
}
if($cfs.triggerHandler(cf_e('slideTo', conf), [s, 0, true, { fx: 'none' }])){
break;
}}
}
var siz=sz_setSizes($cfs, opts),
itm=gi_getCurrentItems($cfs.children(), opts);
if(opts.onCreate){
opts.onCreate.call($tt0, {
'width': siz.width,
'height': siz.height,
'items': itm
});
}
$cfs.trigger(cf_e('updatePageStatus', conf), [true, siz]);
$cfs.trigger(cf_e('linkAnchors', conf));
if(conf.debug){
$cfs.trigger(cf_e('debug', conf));
}
return $cfs;
};
$.fn.carouFredSel.serialNumber=1;
$.fn.carouFredSel.defaults={
'synchronise':false,
'infinite':true,
'circular':true,
'responsive':false,
'centerVertically':false,
'direction':'left',
'items':{
'start':0
},
'scroll':{
'easing':'swing',
'duration':500,
'pauseOnHover':false,
'event':'click',
'queue':false
}};
$.fn.carouFredSel.configs={
'debug':false,
'transition':false,
'onWindowResize': 'throttle',
'events':{
'prefix':'',
'namespace':'cfs'
},
'wrapper':{
'element':'div',
'classname':'caroufredsel_wrapper'
},
'classnames':{}};
$.fn.carouFredSel.pageAnchorBuilder=function(nr){
return ''+nr+'';
};
$.fn.carouFredSel.progressbarUpdater=function(perc){
$(this).css('width', perc+'%');
};
$.fn.carouFredSel.cookie={
get: function(n){
n +='=';
var ca=document.cookie.split(';');
for (var a=0, l=ca.length; a < l; a++){
var c=ca[a];
while (c.charAt(0)==' '){
c=c.slice(1);
}
if(c.indexOf(n)==0){
return c.slice(n.length);
}}
return 0;
},
set: function(n, v, d){
var e="";
if(d){
var date=new Date();
date.setTime(date.getTime() + (d * 24 * 60 * 60 * 1000));
e="; expires=" + date.toGMTString();
}
document.cookie=n + '=' + v + e + '; path=/';
},
remove: function(n){
$.fn.carouFredSel.cookie.set(n, "", -1);
}};
function sc_setScroll(d, e, c){
if(c.transition=='transition'){
if(e=='swing'){
e='ease';
}}
return {
anims: [],
duration: d,
orgDuration: d,
easing: e,
startTime: getTime()
};}
function sc_startScroll(s, c){
for (var a=0, l=s.anims.length; a < l; a++){
var b=s.anims[a];
if(!b){
continue;
}
b[0][c.transition](b[1], s.duration, s.easing, b[2]);
}}
function sc_stopScroll(s, finish){
if(!is_boolean(finish)){
finish=true;
}
if(is_object(s.pre)){
sc_stopScroll(s.pre, finish);
}
for (var a=0, l=s.anims.length; a < l; a++){
var b=s.anims[a];
b[0].stop(true);
if(finish){
b[0].css(b[1]);
if(is_function(b[2])){
b[2]();
}}
}
if(is_object(s.post)){
sc_stopScroll(s.post, finish);
}}
function sc_afterScroll($c, $c2, o){
if($c2){
$c2.remove();
}
switch(o.fx){
case 'fade':
case 'crossfade':
case 'cover-fade':
case 'uncover-fade':
$c.css('opacity', 1);
$c.css('filter', '');
break;
}}
function sc_fireCallbacks($t, o, b, a, c){
if(o[b]){
o[b].call($t, a);
}
if(c[b].length){
for (var i=0, l=c[b].length; i < l; i++){
c[b][i].call($t, a);
}}
return [];
}
function sc_fireQueue($c, q, c){
if(q.length){
$c.trigger(cf_e(q[0][0], c), q[0][1]);
q.shift();
}
return q;
}
function sc_hideHiddenItems(hiddenitems){
hiddenitems.each(function(){
var hi=$(this);
hi.data('_cfs_isHidden', hi.is(':hidden')).hide();
});
}
function sc_showHiddenItems(hiddenitems){
if(hiddenitems){
hiddenitems.each(function(){
var hi=$(this);
if(!hi.data('_cfs_isHidden')){
hi.show();
}});
}}
function sc_clearTimers(t){
if(t.auto){
clearTimeout(t.auto);
}
if(t.progress){
clearInterval(t.progress);
}
return t;
}
function sc_mapCallbackArguments(i_old, i_skp, i_new, s_itm, s_dir, s_dur, w_siz){
return {
'width': w_siz.width,
'height': w_siz.height,
'items': {
'old': i_old,
'skipped': i_skp,
'visible': i_new
},
'scroll': {
'items': s_itm,
'direction': s_dir,
'duration': s_dur
}};}
function sc_getDuration(sO, o, nI, siz){
var dur=sO.duration;
if(sO.fx=='none'){
return 0;
}
if(dur=='auto'){
dur=o.scroll.duration / o.scroll.items * nI;
}
else if(dur < 10){
dur=siz / dur;
}
if(dur < 1){
return 0;
}
if(sO.fx=='fade'){
dur=dur / 2;
}
return Math.round(dur);
}
function nv_showNavi(o, t, c){
var minimum=(is_number(o.items.minimum)) ? o.items.minimum:o.items.visible + 1;
if(t=='show'||t=='hide'){
var f=t;
}
else if(minimum > t){
debug(c, 'Not enough items ('+t+' total, '+minimum+' needed): Hiding navigation.');
var f='hide';
}else{
var f='show';
}
var s=(f=='show') ? 'removeClass':'addClass',
h=cf_c('hidden', c);
if(o.auto.button){
o.auto.button[f]()[s](h);
}
if(o.prev.button){
o.prev.button[f]()[s](h);
}
if(o.next.button){
o.next.button[f]()[s](h);
}
if(o.pagination.container){
o.pagination.container[f]()[s](h);
}}
function nv_enableNavi(o, f, c){
if(o.circular||o.infinite) return;
var fx=(f=='removeClass'||f=='addClass') ? f:false,
di=cf_c('disabled', c);
if(o.auto.button&&fx){
o.auto.button[fx](di);
}
if(o.prev.button){
var fn=fx||(f==0) ? 'addClass':'removeClass';
o.prev.button[fn](di);
}
if(o.next.button){
var fn=fx||(f==o.items.visible) ? 'addClass':'removeClass';
o.next.button[fn](di);
}}
function go_getObject($tt, obj){
if(is_function(obj)){
obj=obj.call($tt);
}
else if(is_undefined(obj)){
obj={};}
return obj;
}
function go_getItemsObject($tt, obj){
obj=go_getObject($tt, obj);
if(is_number(obj)){
obj={
'visible': obj
};}
else if(obj=='variable'){
obj={
'visible': obj,
'width': obj,
'height': obj
};}
else if(!is_object(obj)){
obj={};}
return obj;
}
function go_getScrollObject($tt, obj){
obj=go_getObject($tt, obj);
if(is_number(obj)){
if(obj <=50){
obj={
'items': obj
};}else{
obj={
'duration': obj
};}}
else if(is_string(obj)){
obj={
'easing': obj
};}
else if(!is_object(obj)){
obj={};}
return obj;
}
function go_getNaviObject($tt, obj){
obj=go_getObject($tt, obj);
if(is_string(obj)){
var temp=cf_getKeyCode(obj);
if(temp==-1){
obj=$(obj);
}else{
obj=temp;
}}
return obj;
}
function go_getAutoObject($tt, obj){
obj=go_getNaviObject($tt, obj);
if(is_jquery(obj)){
obj={
'button': obj
};}
else if(is_boolean(obj)){
obj={
'play': obj
};}
else if(is_number(obj)){
obj={
'timeoutDuration': obj
};}
if(obj.progress){
if(is_string(obj.progress)||is_jquery(obj.progress)){
obj.progress={
'bar': obj.progress
};}}
return obj;
}
function go_complementAutoObject($tt, obj){
if(is_function(obj.button)){
obj.button=obj.button.call($tt);
}
if(is_string(obj.button)){
obj.button=$(obj.button);
}
if(!is_boolean(obj.play)){
obj.play=true;
}
if(!is_number(obj.delay)){
obj.delay=0;
}
if(is_undefined(obj.pauseOnEvent)){
obj.pauseOnEvent=true;
}
if(!is_boolean(obj.pauseOnResize)){
obj.pauseOnResize=true;
}
if(!is_number(obj.timeoutDuration)){
obj.timeoutDuration=(obj.duration < 10)
? 2500
: obj.duration * 5;
}
if(obj.progress){
if(is_function(obj.progress.bar)){
obj.progress.bar=obj.progress.bar.call($tt);
}
if(is_string(obj.progress.bar)){
obj.progress.bar=$(obj.progress.bar);
}
if(obj.progress.bar){
if(!is_function(obj.progress.updater)){
obj.progress.updater=$.fn.carouFredSel.progressbarUpdater;
}
if(!is_number(obj.progress.interval)){
obj.progress.interval=50;
}}else{
obj.progress=false;
}}
return obj;
}
function go_getPrevNextObject($tt, obj){
obj=go_getNaviObject($tt, obj);
if(is_jquery(obj)){
obj={
'button': obj
};}
else if(is_number(obj)){
obj={
'key': obj
};}
return obj;
}
function go_complementPrevNextObject($tt, obj){
if(is_function(obj.button)){
obj.button=obj.button.call($tt);
}
if(is_string(obj.button)){
obj.button=$(obj.button);
}
if(is_string(obj.key)){
obj.key=cf_getKeyCode(obj.key);
}
return obj;
}
function go_getPaginationObject($tt, obj){
obj=go_getNaviObject($tt, obj);
if(is_jquery(obj)){
obj={
'container': obj
};}
else if(is_boolean(obj)){
obj={
'keys': obj
};}
return obj;
}
function go_complementPaginationObject($tt, obj){
if(is_function(obj.container)){
obj.container=obj.container.call($tt);
}
if(is_string(obj.container)){
obj.container=$(obj.container);
}
if(!is_number(obj.items)){
obj.items=false;
}
if(!is_boolean(obj.keys)){
obj.keys=false;
}
if(!is_function(obj.anchorBuilder)&&!is_false(obj.anchorBuilder)){
obj.anchorBuilder=$.fn.carouFredSel.pageAnchorBuilder;
}
if(!is_number(obj.deviation)){
obj.deviation=0;
}
return obj;
}
function go_getSwipeObject($tt, obj){
if(is_function(obj)){
obj=obj.call($tt);
}
if(is_undefined(obj)){
obj={
'onTouch': false
};}
if(is_true(obj)){
obj={
'onTouch': obj
};}
else if(is_number(obj)){
obj={
'items': obj
};}
return obj;
}
function go_complementSwipeObject($tt, obj){
if(!is_boolean(obj.onTouch)){
obj.onTouch=true;
}
if(!is_boolean(obj.onMouse)){
obj.onMouse=false;
}
if(!is_object(obj.options)){
obj.options={};}
if(!is_boolean(obj.options.triggerOnTouchEnd)){
obj.options.triggerOnTouchEnd=false;
}
return obj;
}
function go_getMousewheelObject($tt, obj){
if(is_function(obj)){
obj=obj.call($tt);
}
if(is_true(obj)){
obj={};}
else if(is_number(obj)){
obj={
'items': obj
};}
else if(is_undefined(obj)){
obj=false;
}
return obj;
}
function go_complementMousewheelObject($tt, obj){
return obj;
}
function gn_getItemIndex(num, dev, org, items, $cfs){
if(is_string(num)){
num=$(num, $cfs);
}
if(is_object(num)){
num=$(num, $cfs);
}
if(is_jquery(num)){
num=$cfs.children().index(num);
if(!is_boolean(org)){
org=false;
}}else{
if(!is_boolean(org)){
org=true;
}}
if(!is_number(num)){
num=0;
}
if(!is_number(dev)){
dev=0;
}
if(org){
num +=items.first;
}
num +=dev;
if(items.total > 0){
while (num >=items.total){
num -=items.total;
}
while (num < 0){
num +=items.total;
}}
return num;
}
function gn_getVisibleItemsPrev(i, o, s){
var t=0,
x=0;
for (var a=s; a >=0; a--){
var j=i.eq(a);
t +=(j.is(':visible')) ? j[o.d['outerWidth']](true):0;
if(t > o.maxDimension){
return x;
}
if(a==0){
a=i.length;
}
x++;
}}
function gn_getVisibleItemsPrevFilter(i, o, s){
return gn_getItemsPrevFilter(i, o.items.filter, o.items.visibleConf.org, s);
}
function gn_getScrollItemsPrevFilter(i, o, s, m){
return gn_getItemsPrevFilter(i, o.items.filter, m, s);
}
function gn_getItemsPrevFilter(i, f, m, s){
var t=0,
x=0;
for (var a=s, l=i.length; a >=0; a--){
x++;
if(x==l){
return x;
}
var j=i.eq(a);
if(j.is(f)){
t++;
if(t==m){
return x;
}}
if(a==0){
a=l;
}}
}
function gn_getVisibleOrg($c, o){
return o.items.visibleConf.org||$c.children().slice(0, o.items.visible).filter(o.items.filter).length;
}
function gn_getVisibleItemsNext(i, o, s){
var t=0,
x=0;
for (var a=s, l=i.length-1; a <=l; a++){
var j=i.eq(a);
t +=(j.is(':visible')) ? j[o.d['outerWidth']](true):0;
if(t > o.maxDimension){
return x;
}
x++;
if(x==l+1){
return x;
}
if(a==l){
a=-1;
}}
}
function gn_getVisibleItemsNextTestCircular(i, o, s, l){
var v=gn_getVisibleItemsNext(i, o, s);
if(!o.circular){
if(s + v > l){
v=l - s;
}}
return v;
}
function gn_getVisibleItemsNextFilter(i, o, s){
return gn_getItemsNextFilter(i, o.items.filter, o.items.visibleConf.org, s, o.circular);
}
function gn_getScrollItemsNextFilter(i, o, s, m){
return gn_getItemsNextFilter(i, o.items.filter, m+1, s, o.circular) - 1;
}
function gn_getItemsNextFilter(i, f, m, s, c){
var t=0,
x=0;
for (var a=s, l=i.length-1; a <=l; a++){
x++;
if(x >=l){
return x;
}
var j=i.eq(a);
if(j.is(f)){
t++;
if(t==m){
return x;
}}
if(a==l){
a=-1;
}}
}
function gi_getCurrentItems(i, o){
return i.slice(0, o.items.visible);
}
function gi_getOldItemsPrev(i, o, n){
return i.slice(n, o.items.visibleConf.old+n);
}
function gi_getNewItemsPrev(i, o){
return i.slice(0, o.items.visible);
}
function gi_getOldItemsNext(i, o){
return i.slice(0, o.items.visibleConf.old);
}
function gi_getNewItemsNext(i, o, n){
return i.slice(n, o.items.visible+n);
}
function sz_storeMargin(i, o, d){
if(o.usePadding){
if(!is_string(d)){
d='_cfs_origCssMargin';
}
i.each(function(){
var j=$(this),
m=parseInt(j.css(o.d['marginRight']), 10);
if(!is_number(m)){
m=0;
}
j.data(d, m);
});
}}
function sz_resetMargin(i, o, m){
if(o.usePadding){
var x=(is_boolean(m)) ? m:false;
if(!is_number(m)){
m=0;
}
sz_storeMargin(i, o, '_cfs_tempCssMargin');
i.each(function(){
var j=$(this);
j.css(o.d['marginRight'], ((x) ? j.data('_cfs_tempCssMargin'):m + j.data('_cfs_origCssMargin')));
});
}}
function sz_storeOrigCss(i){
i.each(function(){
var j=$(this);
j.data('_cfs_origCss', j.attr('style')||'');
});
}
function sz_restoreOrigCss(i){
i.each(function(){
var j=$(this);
j.attr('style', j.data('_cfs_origCss')||'');
});
}
function sz_setResponsiveSizes(o, all){
var visb=o.items.visible,
newS=o.items[o.d['width']],
seco=o[o.d['height']],
secp=is_percentage(seco);
all.each(function(){
var $t=$(this),
nw=newS - ms_getPaddingBorderMargin($t, o, 'Width');
$t[o.d['width']](nw);
if(secp){
$t[o.d['height']](ms_getPercentage(nw, seco));
}});
}
function sz_setSizes($c, o){
var $w=$c.parent(),
$i=$c.children(),
$v=gi_getCurrentItems($i, o),
sz=cf_mapWrapperSizes(ms_getSizes($v, o, true), o, false);
$w.css(sz);
if(o.usePadding){
var p=o.padding,
r=p[o.d[1]];
if(o.align&&r < 0){
r=0;
}
var $l=$v.last();
$l.css(o.d['marginRight'], $l.data('_cfs_origCssMargin') + r);
$c.css(o.d['top'], p[o.d[0]]);
$c.css(o.d['left'], p[o.d[3]]);
}
$c.css(o.d['width'], sz[o.d['width']]+(ms_getTotalSize($i, o, 'width')*2));
$c.css(o.d['height'], ms_getLargestSize($i, o, 'height'));
if(o['centerVertically']){
$c.css('line-height', sz['height'] + 'px');
}
return sz;
}
function ms_getSizes(i, o, wrapper){
return [ms_getTotalSize(i, o, 'width', wrapper), ms_getLargestSize(i, o, 'height', wrapper)];
}
function ms_getLargestSize(i, o, dim, wrapper){
if(!is_boolean(wrapper)){
wrapper=false;
}
if(is_number(o[o.d[dim]])&&wrapper){
return o[o.d[dim]];
}
if(is_number(o.items[o.d[dim]])){
return o.items[o.d[dim]];
}
dim=(dim.toLowerCase().indexOf('width') > -1) ? 'outerWidth':'outerHeight';
return ms_getTrueLargestSize(i, o, dim);
}
function ms_getTrueLargestSize(i, o, dim){
var s=0;
for (var a=0, l=i.length; a < l; a++){
var j=i.eq(a).find('.fusion-carousel-item-wrapper');
var m=(j.is(':visible')) ? j[o.d[dim]](true):0;
if(s < m){
s=m;
}}
return s;
}
function ms_getTotalSize(i, o, dim, wrapper){
if(!is_boolean(wrapper)){
wrapper=false;
}
if(is_number(o[o.d[dim]])&&wrapper){
return o[o.d[dim]];
}
if(is_number(o.items[o.d[dim]])){
return o.items[o.d[dim]] * i.length;
}
var d=(dim.toLowerCase().indexOf('width') > -1) ? 'outerWidth':'outerHeight',
s=0;
for (var a=0, l=i.length; a < l; a++){
var j=i.eq(a);
s +=(j.is(':visible')) ? j[o.d[d]](true):0;
}
return s;
}
function ms_getParentSize($w, o, d){
var isVisible=$w.is(':visible');
if(isVisible){
$w.hide();
}
var s=$w.parent()[o.d[d]]();
if(isVisible){
$w.show();
}
return s;
}
function ms_getMaxDimension(o, a){
return (is_number(o[o.d['width']])) ? o[o.d['width']]:a;
}
function ms_hasVariableSizes(i, o, dim){
var s=false,
v=false;
for (var a=0, l=i.length; a < l; a++){
var j=i.eq(a);
var c=(j.is(':visible')) ? j[o.d[dim]](true):0;
if(s===false){
s=c;
}
else if(s!=c){
v=true;
}
if(s==0){
v=true;
}}
return v;
}
function ms_getPaddingBorderMargin(i, o, d){
return i[o.d['outer'+d]](true) - i[o.d[d.toLowerCase()]]();
}
function ms_getPercentage(s, o){
if(is_percentage(o)){
o=parseInt(o.slice(0, -1), 10);
if(!is_number(o)){
return s;
}
s *=o/100;
}
return s;
}
function cf_e(n, c, pf, ns, rd){
if(!is_boolean(pf)){
pf=true;
}
if(!is_boolean(ns)){
ns=true;
}
if(!is_boolean(rd)){
rd=false;
}
if(pf){
n=c.events.prefix + n;
}
if(ns){
n=n +'.'+ c.events.namespace;
}
if(ns&&rd){
n +=c.serialNumber;
}
return n;
}
function cf_c(n, c){
return (is_string(c.classnames[n])) ? c.classnames[n]:n;
}
function cf_mapWrapperSizes(ws, o, p){
if(!is_boolean(p)){
p=true;
}
var pad=(o.usePadding&&p) ? o.padding:[0, 0, 0, 0];
var wra={};
wra[o.d['width']]=ws[0] + pad[1] + pad[3];
wra[o.d['height']]=ws[1] + pad[0] + pad[2];
return wra;
}
function cf_sortParams(vals, typs){
var arr=[];
for (var a=0, l1=vals.length; a < l1; a++){
for (var b=0, l2=typs.length; b < l2; b++){
if(typs[b].indexOf(typeof vals[a]) > -1&&is_undefined(arr[b])){
arr[b]=vals[a];
break;
}}
}
return arr;
}
function cf_getPadding(p){
if(is_undefined(p)){
return [0, 0, 0, 0];
}
if(is_number(p)){
return [p, p, p, p];
}
if(is_string(p)){
p=p.split('px').join('').split('em').join('').split(' ');
}
if(!is_array(p)){
return [0, 0, 0, 0];
}
for (var i=0; i < 4; i++){
p[i]=parseInt(p[i], 10);
}
switch (p.length){
case 0:
return [0, 0, 0, 0];
case 1:
return [p[0], p[0], p[0], p[0]];
case 2:
return [p[0], p[1], p[0], p[1]];
case 3:
return [p[0], p[1], p[2], p[1]];
default:
return [p[0], p[1], p[2], p[3]];
}}
function cf_getAlignPadding(itm, o){
var x=(is_number(o[o.d['width']])) ? Math.ceil(o[o.d['width']] - ms_getTotalSize(itm, o, 'width')):0;
switch (o.align){
case 'left':
return [0, x];
case 'right':
return [x, 0];
case 'center':
default:
return [Math.ceil(x/2), Math.floor(x/2)];
}}
function cf_getDimensions(o){
var dm=[
['width' , 'innerWidth' , 'outerWidth' , 'height' , 'innerHeight' , 'outerHeight' , 'left', 'top' , 'marginRight' , 0, 1, 2, 3],
['height' , 'innerHeight' , 'outerHeight' , 'width' , 'innerWidth' , 'outerWidth' , 'top' , 'left', 'marginBottom', 3, 2, 1, 0]
];
var dl=dm[0].length,
dx=(o.direction=='right'||o.direction=='left') ? 0:1;
var dimensions={};
for (var d=0; d < dl; d++){
dimensions[dm[0][d]]=dm[dx][d];
}
return dimensions;
}
function cf_getAdjust(x, o, a, $t){
var v=x;
if(is_function(a)){
v=a.call($t, v);
}
else if(is_string(a)){
var p=a.split('+'),
m=a.split('-');
if(m.length > p.length){
var neg=true,
sta=m[0],
adj=m[1];
}else{
var neg=false,
sta=p[0],
adj=p[1];
}
switch(sta){
case 'even':
v=(x % 2==1) ? x-1:x;
break;
case 'odd':
v=(x % 2==0) ? x-1:x;
break;
default:
v=x;
break;
}
adj=parseInt(adj, 10);
if(is_number(adj)){
if(neg){
adj=-adj;
}
v +=adj;
}}
if(!is_number(v)||v < 1){
v=1;
}
return v;
}
function cf_getItemsAdjust(x, o, a, $t){
return cf_getItemAdjustMinMax(cf_getAdjust(x, o, a, $t), o.items.visibleConf);
}
function cf_getItemAdjustMinMax(v, i){
if(is_number(i.min)&&v < i.min){
v=i.min;
}
if(is_number(i.max)&&v > i.max){
v=i.max;
}
if(v < 1){
v=1;
}
return v;
}
function cf_getSynchArr(s){
if(!is_array(s)){
s=[[s]];
}
if(!is_array(s[0])){
s=[s];
}
for (var j=0, l=s.length; j < l; j++){
if(is_string(s[j][0])){
s[j][0]=$(s[j][0]);
}
if(!is_boolean(s[j][1])){
s[j][1]=true;
}
if(!is_boolean(s[j][2])){
s[j][2]=true;
}
if(!is_number(s[j][3])){
s[j][3]=0;
}}
return s;
}
function cf_getKeyCode(k){
if(k=='right'){
return 39;
}
if(k=='left'){
return 37;
}
if(k=='up'){
return 38;
}
if(k=='down'){
return 40;
}
return -1;
}
function cf_setCookie(n, $c, c){
if(n){
var v=$c.triggerHandler(cf_e('currentPosition', c));
$.fn.carouFredSel.cookie.set(n, v);
}}
function cf_getCookie(n){
var c=$.fn.carouFredSel.cookie.get(n);
return (c=='') ? 0:c;
}
function in_mapCss($elem, props){
var css={};
for (var p=0, l=props.length; p < l; p++){
css[props[p]]=$elem.css(props[p]);
}
return css;
}
function in_complementItems(obj, opt, itm, sta){
if(!is_object(obj.visibleConf)){
obj.visibleConf={};}
if(!is_object(obj.sizesConf)){
obj.sizesConf={};}
if(obj.start==0&&is_number(sta)){
obj.start=sta;
}
if(is_object(obj.visible)){
obj.visibleConf.min=obj.visible.min;
obj.visibleConf.max=obj.visible.max;
obj.visible=false;
}
else if(is_string(obj.visible)){
if(obj.visible=='variable'){
obj.visibleConf.variable=true;
}else{
obj.visibleConf.adjust=obj.visible;
}
obj.visible=false;
}
else if(is_function(obj.visible)){
obj.visibleConf.adjust=obj.visible;
obj.visible=false;
}
if(!is_string(obj.filter)){
obj.filter=(itm.filter(':hidden').length > 0) ? ':visible':'*';
}
if(!obj[opt.d['width']]){
if(opt.responsive){
debug(true, 'Set a '+opt.d['width']+' for the items!');
obj[opt.d['width']]=ms_getTrueLargestSize(itm, opt, 'outerWidth');
}else{
obj[opt.d['width']]=(ms_hasVariableSizes(itm, opt, 'outerWidth'))
? 'variable'
: itm[opt.d['outerWidth']](true);
}}
if(!obj[opt.d['height']]){
obj[opt.d['height']]=(ms_hasVariableSizes(itm, opt, 'outerHeight'))
? 'variable'
: itm[opt.d['outerHeight']](true);
}
obj.sizesConf.width=obj.width;
obj.sizesConf.height=obj.height;
return obj;
}
function in_complementVisibleItems(opt, avl){
if(opt.items[opt.d['width']]=='variable'){
opt.items.visibleConf.variable=true;
}
if(!opt.items.visibleConf.variable){
if(is_number(opt[opt.d['width']])){
opt.items.visible=Math.floor(opt[opt.d['width']] / opt.items[opt.d['width']]);
}else{
opt.items.visible=Math.floor(avl / opt.items[opt.d['width']]);
opt[opt.d['width']]=opt.items.visible * opt.items[opt.d['width']];
if(!opt.items.visibleConf.adjust){
opt.align=false;
}}
if(opt.items.visible=='Infinity'||opt.items.visible < 1){
debug(true, 'Not a valid number of visible items: Set to "variable".');
opt.items.visibleConf.variable=true;
}}
return opt;
}
function in_complementPrimarySize(obj, opt, all){
if(obj=='auto'){
obj=ms_getTrueLargestSize(all, opt, 'outerWidth');
}
return obj;
}
function in_complementSecondarySize(obj, opt, all){
if(obj=='auto'){
obj=ms_getTrueLargestSize(all, opt, 'outerHeight');
}
if(!obj){
obj=opt.items[opt.d['height']];
}
return obj;
}
function in_getAlignPadding(o, all){
var p=cf_getAlignPadding(gi_getCurrentItems(all, o), o);
o.padding[o.d[1]]=p[1];
o.padding[o.d[3]]=p[0];
return o;
}
function in_getResponsiveValues(o, all, avl){
var visb=cf_getItemAdjustMinMax(Math.ceil(o[o.d['width']] / o.items[o.d['width']]), o.items.visibleConf);
if(visb > all.length){
visb=all.length;
}
var newS=Math.floor(o[o.d['width']]/visb);
o.items.visible=visb;
o.items[o.d['width']]=newS;
o[o.d['width']]=visb * newS;
return o;
}
function bt_pauseOnHoverConfig(p){
if(is_string(p)){
var i=(p.indexOf('immediate') > -1) ? true:false,
r=(p.indexOf('resume') > -1) ? true:false;
}else{
var i=r = false;
}
return [i, r];
}
function bt_mousesheelNumber(mw){
return (is_number(mw)) ? mw:null
}
function is_null(a){
return (a===null);
}
function is_undefined(a){
return (is_null(a)||typeof a=='undefined'||a===''||a==='undefined');
}
function is_array(a){
return (a instanceof Array);
}
function is_jquery(a){
return (a instanceof jQuery);
}
function is_object(a){
return ((a instanceof Object||typeof a=='object')&&!is_null(a)&&!is_jquery(a)&&!is_array(a)&&!is_function(a));
}
function is_number(a){
return ((a instanceof Number||typeof a=='number')&&!isNaN(a));
}
function is_string(a){
return ((a instanceof String||typeof a=='string')&&!is_undefined(a)&&!is_true(a)&&!is_false(a));
}
function is_function(a){
return (a instanceof Function||typeof a=='function');
}
function is_boolean(a){
return (a instanceof Boolean||typeof a=='boolean'||is_true(a)||is_false(a));
}
function is_true(a){
return (a===true||a==='true');
}
function is_false(a){
return (a===false||a==='false');
}
function is_percentage(x){
return (is_string(x)&&x.slice(-1)=='%');
}
function getTime(){
return new Date().getTime();
}
function deprecated(o, n){
debug(true, o+' is DEPRECATED, support for it will be removed. Use '+n+' instead.');
}
function debug(d, m){
if(!is_undefined(window.console)&&!is_undefined(window.console.log)){
if(is_object(d)){
var s=' ('+d.selector+')';
d=d.debug;
}else{
var s='';
}
if(!d){
return false;
}
if(is_string(m)){
m='carouFredSel'+s+': ' + m;
}else{
m=['carouFredSel'+s+':', m];
}
window.console.log(m);
}
return false;
}
$.extend($.easing, {
'quadratic': function(t){
var t2=t * t;
return t * (-t2 * t + 4 * t2 - 6 * t + 4);
},
'cubic': function(t){
return t * (4 * t * t - 9 * t + 6);
},
'elastic': function(t){
var t2=t * t;
return t * (33 * t2 * t2 - 106 * t2 * t + 126 * t2 - 67 * t + 15);
}});
})(jQuery);
(function ($){
$.fn.countTo=function (options){
options=options||{};
return $(this).each(function (){
var settings=$.extend({}, $.fn.countTo.defaults, {
from: $(this).data('from'),
to: $(this).data('to'),
speed: $(this).data('speed'),
refreshInterval: $(this).data('refresh-interval'),
decimals: $(this).data('decimals')
}, options);
var loops=Math.ceil(settings.speed / settings.refreshInterval),
increment=(settings.to - settings.from) / loops;
var self=this,
$self=$(this),
loopCount=0,
value=settings.from,
data=$self.data('countTo')||{};
$self.data('countTo', data);
if(data.interval){
clearInterval(data.interval);
}
data.interval=setInterval(updateTimer, settings.refreshInterval);
render(value);
function updateTimer(){
value +=increment;
loopCount++;
render(value);
if(typeof(settings.onUpdate)=='function'){
settings.onUpdate.call(self, value);
}
if(loopCount >=loops){
$self.removeData('countTo');
clearInterval(data.interval);
value=settings.to;
if(typeof(settings.onComplete)=='function'){
settings.onComplete.call(self, value);
}}
}
function render(value){
var formattedValue=settings.formatter.call(self, value, settings);
$self.text(formattedValue);
}});
};
$.fn.countTo.defaults={
from: 0,
to: 0,
speed: 1000,
refreshInterval: 100,
decimals: 0,
formatter: formatter,
onUpdate: null,
onComplete: null
};
function formatter(value, settings){
return value.toFixed(settings.decimals);
}}(jQuery));
(function($){
$.fn.countDown=function (options){
config={};
$.extend(config, options);
diffSecs=this.setCountDown(config);
if(config.onComplete){
$.data($(this)[0], 'callback', config.onComplete);
}
if(config.omitWeeks){
$.data($(this)[0], 'omitWeeks', config.omitWeeks);
}
$('#' + $(this).attr('id') + ' .fusion-digit').html('');
$(this).doCountDown($(this).attr('id'), diffSecs, 500);
return this;
};
$.fn.stopCountDown=function (){
clearTimeout($.data(this[0], 'timer'));
};
$.fn.startCountDown=function (){
this.doCountDown($(this).attr('id'),$.data(this[0], 'diffSecs'), 500);
};
$.fn.setCountDown=function (options){
var targetTime=new Date();
if(options.targetDate){
targetTime=new Date(options.targetDate.month + '/' + options.targetDate.day + '/' + options.targetDate.year + ' ' + options.targetDate.hour + ':' + options.targetDate.min + ':' + options.targetDate.sec + (options.targetDate.utc ? ' UTC':''));
}
else if(options.targetOffset){
targetTime.setFullYear(options.targetOffset.year + targetTime.getFullYear());
targetTime.setMonth(options.targetOffset.month + targetTime.getMonth());
targetTime.setDate(options.targetOffset.day + targetTime.getDate());
targetTime.setHours(options.targetOffset.hour + targetTime.getHours());
targetTime.setMinutes(options.targetOffset.min + targetTime.getMinutes());
targetTime.setSeconds(options.targetOffset.sec + targetTime.getSeconds());
}
var nowTime=new Date();
if(options.gmtOffset){
var site_offset=options.gmtOffset*60*60000,
user_offset=nowTime.getTimezoneOffset()*60000;
nowTime=new Date(nowTime.getTime() + site_offset + user_offset);
}
diffSecs=Math.floor((targetTime.valueOf()-nowTime.valueOf())/1000);
$.data(this[0], 'diffSecs', diffSecs);
return diffSecs;
};
$.fn.doCountDown=function (id, diffSecs, duration){
$this=$('#' + id);
if(diffSecs <=0){
diffSecs=0;
if($this.data('timer')){
clearTimeout($this.data('timer'));
}}
secs=diffSecs % 60;
mins=Math.floor(diffSecs/60)%60;
hours=Math.floor(diffSecs/60/60)%24;
if($this.data('omitWeeks')==true){
days=Math.floor(diffSecs/60/60/24);
weeks=Math.floor(diffSecs/60/60/24/7);
}else{
days=Math.floor(diffSecs/60/60/24)%7;
weeks=Math.floor(diffSecs/60/60/24/7);
}
if(days > 99){
$this.find('.fusion-dash-days').find('.fusion-first-digit').css('display', 'inline-block');
}
$this.dashChangeTo(id, 'fusion-dash-seconds', secs, duration ? duration:800);
$this.dashChangeTo(id, 'fusion-dash-minutes', mins, duration ? duration:1200);
$this.dashChangeTo(id, 'fusion-dash-hours', hours, duration ? duration:1200);
$this.dashChangeTo(id, 'fusion-dash-days', days, duration ? duration:1200);
$this.dashChangeTo(id, 'fusion-dash-weeks', weeks, duration ? duration:1200);
$.data($this[0], 'diffSecs', diffSecs);
if(diffSecs > 0){
e=$this;
t=setTimeout(function(){ e.doCountDown(id, diffSecs-1) } , 1000);
$.data(e[0], 'timer', t);
}
else if(cb=$.data($this[0], 'callback')){
$.data($this[0], 'callback')();
}};
$.fn.dashChangeTo=function(id, dash, n, duration){
$this=$('#' + id);
for (var i=($this.find('.' + dash + ' .fusion-digit').length-1); i>=0; i--){
var d=n%10;
n=(n - d) / 10;
$this.digitChangeTo('#' + $this.attr('id') + ' .' + dash + ' .fusion-digit:eq('+i+')', d, duration);
}};
$.fn.digitChangeTo=function (digit, n, duration){
var top_digit=$(digit + ' div.top'),
bottom_digit=$(digit + ' div.bottom');
if(!duration){
duration=800;
}
if(top_digit.html()!=n + ''&&top_digit.not(':animated').length){
top_digit.css({'display': 'none'});
top_digit.html((n ? n:'0')).fadeOut(duration, function(){
bottom_digit.html(top_digit.html());
bottom_digit.css({'display': 'block', 'height': 'auto'});
top_digit.css({'display': 'none'});
});
}};})(jQuery);
;(function($, undefined){
"use strict";
var ver='3.0.3';
function debug(s){
if($.fn.cycle.debug)
log(s);
}
function log(){
if(window.console&&console.log){
}}
$.expr[':'].paused=function(el){
return el.cyclePause;
};
$.fn.cycle=function(options, arg2){
var o={ s: this.selector, c: this.context };
if(this.length===0&&options!='stop'){
if(!$.isReady&&o.s){
log('DOM not ready, queuing slideshow');
$(function(){
$(o.s,o.c).cycle(options,arg2);
});
return this;
}
log('terminating; zero elements found by selector' + ($.isReady ? '':' (DOM not ready)'));
return this;
}
return this.each(function(){
var opts=handleArguments(this, options, arg2);
if(opts===false)
return;
opts.updateActivePagerLink=opts.updateActivePagerLink||$.fn.cycle.updateActivePagerLink;
if(this.cycleTimeout)
clearTimeout(this.cycleTimeout);
this.cycleTimeout=this.cyclePause=0;
this.cycleStop=0;
var $cont=$(this);
var $slides=opts.slideExpr ? $(opts.slideExpr, this):$cont.children();
var els=$slides.get();
if(els.length < 2){
log('terminating; too few slides: ' + els.length);
return;
}
var opts2=buildOptions($cont, $slides, els, opts, o);
if(opts2===false)
return;
var startTime=opts2.continuous ? 10:getTimeout(els[opts2.currSlide], els[opts2.nextSlide], opts2, !opts2.backwards);
if(startTime){
startTime +=(opts2.delay||0);
if(startTime < 10)
startTime=10;
debug('first timeout: ' + startTime);
this.cycleTimeout=setTimeout(function(){go(els,opts2,0,!opts.backwards);}, startTime);
}});
};
function triggerPause(cont, byHover, onPager){
var opts=$(cont).data('cycle.opts');
if(!opts)
return;
var paused = !!cont.cyclePause;
if(paused&&opts.paused)
opts.paused(cont, opts, byHover, onPager);
else if(!paused&&opts.resumed)
opts.resumed(cont, opts, byHover, onPager);
}
function handleArguments(cont, options, arg2){
if(cont.cycleStop===undefined)
cont.cycleStop=0;
if(options===undefined||options===null)
options={};
if(options.constructor==String){
switch(options){
case 'destroy':
case 'stop':
var opts=$(cont).data('cycle.opts');
if(!opts)
return false;
cont.cycleStop++;
if(cont.cycleTimeout)
clearTimeout(cont.cycleTimeout);
cont.cycleTimeout=0;
if(opts.elements)
$(opts.elements).stop();
$(cont).removeData('cycle.opts');
if(options=='destroy')
destroy(cont, opts);
return false;
case 'toggle':
cont.cyclePause=(cont.cyclePause===1) ? 0:1;
checkInstantResume(cont.cyclePause, arg2, cont);
triggerPause(cont);
return false;
case 'pause':
cont.cyclePause=1;
triggerPause(cont);
return false;
case 'resume':
cont.cyclePause=0;
checkInstantResume(false, arg2, cont);
triggerPause(cont);
return false;
case 'prev':
case 'next':
opts=$(cont).data('cycle.opts');
if(!opts){
log('options not found, "prev/next" ignored');
return false;
}
if(typeof arg2=='string')
opts.oneTimeFx=arg2;
$.fn.cycle[options](opts);
return false;
default:
options={ fx: options };}
return options;
}
else if(options.constructor==Number){
var num=options;
options=$(cont).data('cycle.opts');
if(!options){
log('options not found, can not advance slide');
return false;
}
if(num < 0||num >=options.elements.length){
log('invalid slide index: ' + num);
return false;
}
options.nextSlide=num;
if(cont.cycleTimeout){
clearTimeout(cont.cycleTimeout);
cont.cycleTimeout=0;
}
if(typeof arg2=='string')
options.oneTimeFx=arg2;
go(options.elements, options, 1, num >=options.currSlide);
return false;
}
return options;
function checkInstantResume(isPaused, arg2, cont){
if(!isPaused&&arg2===true){
var options=$(cont).data('cycle.opts');
if(!options){
log('options not found, can not resume');
return false;
}
if(cont.cycleTimeout){
clearTimeout(cont.cycleTimeout);
cont.cycleTimeout=0;
}
go(options.elements, options, 1, !options.backwards);
}}
}
function removeFilter(el, opts){
if(!$.support.opacity&&opts.cleartype&&el.style.filter){
try { el.style.removeAttribute('filter'); }
catch(smother){}}
}
function destroy(cont, opts){
if(opts.next)
$(opts.next).unbind(opts.prevNextEvent);
if(opts.prev)
$(opts.prev).unbind(opts.prevNextEvent);
if(opts.pager||opts.pagerAnchorBuilder)
$.each(opts.pagerAnchors||[], function(){
this.unbind().remove();
});
opts.pagerAnchors=null;
$(cont).unbind('mouseenter.cycle mouseleave.cycle');
if(opts.destroy)
opts.destroy(opts);
}
function buildOptions($cont, $slides, els, options, o){
var startingSlideSpecified;
var opts=$.extend({}, $.fn.cycle.defaults, options||{}, $.metadata ? $cont.metadata():$.meta ? $cont.data():{});
var meta=$.isFunction($cont.data) ? $cont.data(opts.metaAttr):null;
if(meta)
opts=$.extend(opts, meta);
if(opts.autostop)
opts.countdown=opts.autostopCount||els.length;
var cont=$cont[0];
$cont.data('cycle.opts', opts);
opts.$cont=$cont;
opts.stopCount=cont.cycleStop;
opts.elements=els;
opts.before=opts.before ? [opts.before]:[];
opts.after=opts.after ? [opts.after]:[];
if(!$.support.opacity&&opts.cleartype)
opts.after.push(function(){ removeFilter(this, opts); });
if(opts.continuous)
opts.after.push(function(){ go(els,opts,0,!opts.backwards); });
saveOriginalOpts(opts);
if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg)
clearTypeFix($slides);
if($cont.css('position')=='static')
$cont.css('position', 'relative');
if(opts.width)
$cont.width(opts.width);
if(opts.height&&opts.height!='auto')
$cont.height(opts.height);
if(opts.startingSlide!==undefined){
opts.startingSlide=parseInt(opts.startingSlide,10);
if(opts.startingSlide >=els.length||opts.startSlide < 0){
opts.startingSlide=0;
}else{
startingSlideSpecified=true;
}}else if(opts.backwards){
opts.startingSlide=els.length - 1;
}else{
opts.startingSlide=0;
}
if(opts.random){
opts.randomMap=[];
for (var i=0; i < els.length; i++)
opts.randomMap.push(i);
opts.randomMap.sort(function(a,b){return Math.random() - 0.5;});
if(startingSlideSpecified){
for(var cnt=0; cnt < els.length; cnt++){
if(opts.startingSlide==opts.randomMap[cnt]){
opts.randomIndex=cnt;
}}
}else{
opts.randomIndex=1;
opts.startingSlide=opts.randomMap[1];
}}
else if(opts.startingSlide >=els.length)
opts.startingSlide=0;
opts.currSlide=opts.startingSlide||0;
var first=opts.startingSlide;
$slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i){
var z;
if(opts.backwards){
z=first ? i <=first ? els.length + (i-first):first-i:els.length-i;
}else{
z=first ? i >=first ? els.length - (i-first):first-i:els.length-i;
}
$(this).css('z-index', z);
});
$(els[first]).css('opacity',1).show();
removeFilter(els[first], opts);
if(opts.fit){
if(!opts.aspect){
if(opts.width)
$slides.width(opts.width);
if(opts.height&&opts.height!='auto')
$slides.height(opts.height);
}else{
$slides.each(function(){
var $slide=$(this);
var ratio=(opts.aspect===true) ? $slide.width()/$slide.height():opts.aspect;
if(opts.width&&$slide.width()!=opts.width){
$slide.width(opts.width);
$slide.height(opts.width / ratio);
}
if(opts.height&&$slide.height() < opts.height){
$slide.height(opts.height);
$slide.width(opts.height * ratio);
}});
}}
if(opts.center&&((!opts.fit)||opts.aspect)){
$slides.each(function(){
var $slide=$(this);
$slide.css({
"margin-left": opts.width ?
((opts.width - $slide.width()) / 2) + "px" :
0,
"margin-top": opts.height ?
((opts.height - $slide.height()) / 2) + "px" :
0
});
});
}
if(opts.center&&!opts.fit&&!opts.slideResize){
$slides.each(function(){
var $slide=$(this);
$slide.css({
"margin-left": opts.width ? ((opts.width - $slide.width()) / 2) + "px":0,
"margin-top": opts.height ? ((opts.height - $slide.height()) / 2) + "px":0
});
});
}
var reshape=(opts.containerResize||opts.containerResizeHeight)&&$cont.innerHeight() < 1;
if(reshape){
var maxw=0, maxh=0;
for(var j=0; j < els.length; j++){
var $e=$(els[j]), e=$e[0], w=$e.outerWidth(), h=$e.outerHeight();
if(!w) w=e.offsetWidth||e.width||$e.attr('width');
if(!h) h=e.offsetHeight||e.height||$e.attr('height');
maxw=w > maxw ? w:maxw;
maxh=h > maxh ? h:maxh;
}
if(opts.containerResize&&maxw > 0&&maxh > 0)
$cont.animate({width:maxw+'px',height:maxh+'px'});
if(opts.containerResizeHeight&&maxh > 0)
$cont.animate({height:maxh+'px'});
}
var pauseFlag=false;
if(opts.pause)
$cont.bind('mouseenter.cycle', function(){
pauseFlag=true;
this.cyclePause++;
triggerPause(cont, true);
}).bind('mouseleave.cycle', function(){
if(pauseFlag)
this.cyclePause--;
triggerPause(cont, true);
});
if(supportMultiTransitions(opts)===false)
return false;
var requeue=false;
options.requeueAttempts=options.requeueAttempts||0;
$slides.each(function(){
var $el=$(this);
this.cycleH=(opts.fit&&opts.height) ? opts.height:($el.height()||this.offsetHeight||this.height||$el.attr('height')||0);
this.cycleW=(opts.fit&&opts.width) ? opts.width:($el.width()||this.offsetWidth||this.width||$el.attr('width')||0);
if($el.is('img')){
var loading=(this.cycleH===0&&this.cycleW===0&&!this.complete);
if(loading){
if(o.s&&opts.requeueOnImageNotLoaded&&++options.requeueAttempts < 100){
log(options.requeueAttempts,' - img slide not loaded, requeuing slideshow: ', this.src, this.cycleW, this.cycleH);
setTimeout(function(){$(o.s,o.c).cycle(options);}, opts.requeueTimeout);
requeue=true;
return false;
}else{
log('could not determine size of image: '+this.src, this.cycleW, this.cycleH);
}}
}
return true;
});
if(requeue)
return false;
opts.cssBefore=opts.cssBefore||{};
opts.cssAfter=opts.cssAfter||{};
opts.cssFirst=opts.cssFirst||{};
opts.animIn=opts.animIn||{};
opts.animOut=opts.animOut||{};
$slides.not(':eq('+first+')').css(opts.cssBefore);
$($slides[first]).css(opts.cssFirst);
if(opts.timeout){
opts.timeout=parseInt(opts.timeout,10);
if(opts.speed.constructor==String)
opts.speed=$.fx.speeds[opts.speed]||parseInt(opts.speed,10);
if(!opts.sync)
opts.speed=opts.speed / 2;
var buffer=opts.fx=='none' ? 0:opts.fx=='shuffle' ? 500:250;
while((opts.timeout - opts.speed) < buffer)
opts.timeout +=opts.speed;
}
if(opts.easing)
opts.easeIn=opts.easeOut=opts.easing;
if(!opts.speedIn)
opts.speedIn=opts.speed;
if(!opts.speedOut)
opts.speedOut=opts.speed;
opts.slideCount=els.length;
opts.currSlide=opts.lastSlide=first;
if(opts.random){
if(++opts.randomIndex==els.length)
opts.randomIndex=0;
opts.nextSlide=opts.randomMap[opts.randomIndex];
}
else if(opts.backwards){
opts.nextSlide=opts.startingSlide===0 ? (els.length-1):opts.startingSlide-1;
}else{
opts.nextSlide=opts.startingSlide >=(els.length-1) ? 0:opts.startingSlide+1;
}
if(!opts.multiFx){
var init=$.fn.cycle.transitions[opts.fx];
if($.isFunction(init))
init($cont, $slides, opts);
else if(opts.fx!='custom'&&!opts.multiFx){
log('unknown transition: ' + opts.fx,'; slideshow terminating');
return false;
}}
var e0=$slides[first];
if(!opts.skipInitializationCallbacks){
if(opts.before.length)
opts.before[0].apply(e0, [e0, e0, opts, true]);
if(opts.after.length)
opts.after[0].apply(e0, [e0, e0, opts, true]);
}
if(opts.next)
$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,1);});
if(opts.prev)
$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,0);});
if(opts.pager||opts.pagerAnchorBuilder)
buildPager(els,opts);
exposeAddSlide(opts, els);
return opts;
}
function saveOriginalOpts(opts){
opts.original={ before: [], after: [] };
opts.original.cssBefore=$.extend({}, opts.cssBefore);
opts.original.cssAfter=$.extend({}, opts.cssAfter);
opts.original.animIn=$.extend({}, opts.animIn);
opts.original.animOut=$.extend({}, opts.animOut);
$.each(opts.before, function(){ opts.original.before.push(this); });
$.each(opts.after, function(){ opts.original.after.push(this); });
}
function supportMultiTransitions(opts){
var i, tx, txs=$.fn.cycle.transitions;
if(opts.fx.indexOf(',') > 0){
opts.multiFx=true;
opts.fxs=opts.fx.replace(/\s*/g,'').split(',');
for (i=0; i < opts.fxs.length; i++){
var fx=opts.fxs[i];
tx=txs[fx];
if(!tx||!txs.hasOwnProperty(fx)||!$.isFunction(tx)){
log('discarding unknown transition: ',fx);
opts.fxs.splice(i,1);
i--;
}}
if(!opts.fxs.length){
log('No valid transitions named; slideshow terminating.');
return false;
}}
else if(opts.fx=='all'){
opts.multiFx=true;
opts.fxs=[];
for (var p in txs){
if(txs.hasOwnProperty(p)){
tx=txs[p];
if(txs.hasOwnProperty(p)&&$.isFunction(tx))
opts.fxs.push(p);
}}
}
if(opts.multiFx&&opts.randomizeEffects){
var r1=Math.floor(Math.random() * 20) + 30;
for (i=0; i < r1; i++){
var r2=Math.floor(Math.random() * opts.fxs.length);
opts.fxs.push(opts.fxs.splice(r2,1)[0]);
}
debug('randomized fx sequence: ',opts.fxs);
}
return true;
}
function exposeAddSlide(opts, els){
opts.addSlide=function(newSlide, prepend){
var $s=$(newSlide), s=$s[0];
if(!opts.autostopCount)
opts.countdown++;
els[prepend?'unshift':'push'](s);
if(opts.els)
opts.els[prepend?'unshift':'push'](s);
opts.slideCount=els.length;
if(opts.random){
opts.randomMap.push(opts.slideCount-1);
opts.randomMap.sort(function(a,b){return Math.random() - 0.5;});
}
$s.css('position','absolute');
$s[prepend?'prependTo':'appendTo'](opts.$cont);
if(prepend){
opts.currSlide++;
opts.nextSlide++;
}
if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg)
clearTypeFix($s);
if(opts.fit&&opts.width)
$s.width(opts.width);
if(opts.fit&&opts.height&&opts.height!='auto')
$s.height(opts.height);
s.cycleH=(opts.fit&&opts.height) ? opts.height:$s.height();
s.cycleW=(opts.fit&&opts.width) ? opts.width:$s.width();
$s.css(opts.cssBefore);
if(opts.pager||opts.pagerAnchorBuilder)
$.fn.cycle.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts);
if($.isFunction(opts.onAddSlide))
opts.onAddSlide($s);
else
$s.hide();
};}
$.fn.cycle.resetState=function(opts, fx){
fx=fx||opts.fx;
opts.before=[]; opts.after=[];
opts.cssBefore=$.extend({}, opts.original.cssBefore);
opts.cssAfter=$.extend({}, opts.original.cssAfter);
opts.animIn=$.extend({}, opts.original.animIn);
opts.animOut=$.extend({}, opts.original.animOut);
opts.fxFn=null;
$.each(opts.original.before, function(){ opts.before.push(this); });
$.each(opts.original.after, function(){ opts.after.push(this); });
var init=$.fn.cycle.transitions[fx];
if($.isFunction(init))
init(opts.$cont, $(opts.elements), opts);
};
function go(els, opts, manual, fwd){
var p=opts.$cont[0], curr=els[opts.currSlide], next=els[opts.nextSlide];
if(manual&&opts.busy&&opts.manualTrump){
debug('manualTrump in go(), stopping active transition');
$(els).stop(true,true);
opts.busy=0;
clearTimeout(p.cycleTimeout);
}
if(opts.busy){
debug('transition active, ignoring new tx request');
return;
}
if(p.cycleStop!=opts.stopCount||p.cycleTimeout===0&&!manual)
return;
if(!manual&&!p.cyclePause&&!opts.bounce &&
((opts.autostop&&(--opts.countdown <=0)) ||
(opts.nowrap&&!opts.random&&opts.nextSlide < opts.currSlide))){
if(opts.end)
opts.end(opts);
return;
}
var changed=false;
if((manual||!p.cyclePause)&&(opts.nextSlide!=opts.currSlide)){
changed=true;
var fx=opts.fx;
curr.cycleH=curr.cycleH||$(curr).height();
curr.cycleW=curr.cycleW||$(curr).width();
next.cycleH=next.cycleH||$(next).height();
next.cycleW=next.cycleW||$(next).width();
if(opts.multiFx){
if(fwd&&(opts.lastFx===undefined||++opts.lastFx >=opts.fxs.length))
opts.lastFx=0;
else if(!fwd&&(opts.lastFx===undefined||--opts.lastFx < 0))
opts.lastFx=opts.fxs.length - 1;
fx=opts.fxs[opts.lastFx];
}
if(opts.oneTimeFx){
fx=opts.oneTimeFx;
opts.oneTimeFx=null;
}
$.fn.cycle.resetState(opts, fx);
if(opts.before.length)
$.each(opts.before, function(i,o){
if(p.cycleStop!=opts.stopCount) return;
o.apply(next, [curr, next, opts, fwd]);
});
var after=function(){
opts.busy=0;
$.each(opts.after, function(i,o){
if(p.cycleStop!=opts.stopCount) return;
o.apply(next, [curr, next, opts, fwd]);
});
if(!p.cycleStop){
queueNext();
}};
debug('tx firing('+fx+'); currSlide: ' + opts.currSlide + '; nextSlide: ' + opts.nextSlide);
opts.busy=1;
if(opts.fxFn){
opts.fxFn(curr, next, opts, after, fwd, manual&&opts.fastOnEvent);
}else if($.isFunction($.fn.cycle[opts.fx])){
$.fn.cycle[opts.fx](curr, next, opts, after, fwd, manual&&opts.fastOnEvent);
}else{
$.fn.cycle.custom(curr, next, opts, after, fwd, manual&&opts.fastOnEvent);
}}else{
queueNext();
}
if(changed||opts.nextSlide==opts.currSlide){
var roll;
opts.lastSlide=opts.currSlide;
if(opts.random){
opts.currSlide=opts.nextSlide;
if(++opts.randomIndex==els.length){
opts.randomIndex=0;
opts.randomMap.sort(function(a,b){return Math.random() - 0.5;});
}
opts.nextSlide=opts.randomMap[opts.randomIndex];
if(opts.nextSlide==opts.currSlide)
opts.nextSlide=(opts.currSlide==opts.slideCount - 1) ? 0:opts.currSlide + 1;
}
else if(opts.backwards){
roll=(opts.nextSlide - 1) < 0;
if(roll&&opts.bounce){
opts.backwards = !opts.backwards;
opts.nextSlide=1;
opts.currSlide=0;
}else{
opts.nextSlide=roll ? (els.length-1):opts.nextSlide-1;
opts.currSlide=roll ? 0:opts.nextSlide+1;
}}else{
roll=(opts.nextSlide + 1)==els.length;
if(roll&&opts.bounce){
opts.backwards = !opts.backwards;
opts.nextSlide=els.length-2;
opts.currSlide=els.length-1;
}else{
opts.nextSlide=roll ? 0:opts.nextSlide+1;
opts.currSlide=roll ? els.length-1:opts.nextSlide-1;
}}
}
if(changed&&opts.pager)
opts.updateActivePagerLink(opts.pager, opts.currSlide, opts.activePagerClass);
function queueNext(){
var ms=0, timeout=opts.timeout;
if(opts.timeout&&!opts.continuous){
ms=getTimeout(els[opts.currSlide], els[opts.nextSlide], opts, fwd);
if(opts.fx=='shuffle')
ms -=opts.speedOut;
}
else if(opts.continuous&&p.cyclePause)
ms=10;
if(ms > 0)
p.cycleTimeout=setTimeout(function(){ go(els, opts, 0, !opts.backwards); }, ms);
}}
$.fn.cycle.updateActivePagerLink=function(pager, currSlide, clsName){
$(pager).each(function(){
$(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);
});
};
function getTimeout(curr, next, opts, fwd){
if(opts.timeoutFn){
var t=opts.timeoutFn.call(curr,curr,next,opts,fwd);
while (opts.fx!='none'&&(t - opts.speed) < 250)
t +=opts.speed;
debug('calculated timeout: ' + t + '; speed: ' + opts.speed);
if(t!==false)
return t;
}
return opts.timeout;
}
$.fn.cycle.next=function(opts){ advance(opts,1); };
$.fn.cycle.prev=function(opts){ advance(opts,0);};
function advance(opts, moveForward){
var val=moveForward ? 1:-1;
var els=opts.elements;
var p=opts.$cont[0], timeout=p.cycleTimeout;
if(timeout){
clearTimeout(timeout);
p.cycleTimeout=0;
}
if(opts.random&&val < 0){
opts.randomIndex--;
if(--opts.randomIndex==-2)
opts.randomIndex=els.length-2;
else if(opts.randomIndex==-1)
opts.randomIndex=els.length-1;
opts.nextSlide=opts.randomMap[opts.randomIndex];
}
else if(opts.random){
opts.nextSlide=opts.randomMap[opts.randomIndex];
}else{
opts.nextSlide=opts.currSlide + val;
if(opts.nextSlide < 0){
if(opts.nowrap) return false;
opts.nextSlide=els.length - 1;
}
else if(opts.nextSlide >=els.length){
if(opts.nowrap) return false;
opts.nextSlide=0;
}}
var cb=opts.onPrevNextEvent||opts.prevNextClick;
if($.isFunction(cb))
cb(val > 0, opts.nextSlide, els[opts.nextSlide]);
go(els, opts, 1, moveForward);
return false;
}
function buildPager(els, opts){
var $p=$(opts.pager);
$.each(els, function(i,o){
$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);
});
opts.updateActivePagerLink(opts.pager, opts.startingSlide, opts.activePagerClass);
}
$.fn.cycle.createPagerAnchor=function(i, el, $p, els, opts){
var a;
if($.isFunction(opts.pagerAnchorBuilder)){
a=opts.pagerAnchorBuilder(i,el);
debug('pagerAnchorBuilder('+i+', el) returned: ' + a);
}else{
a='';
}
if(!a)
return;
var $a=$(a);
if($a.parents('body').length===0){
var arr=[];
if($p.length > 1){
$p.each(function(){
var $clone=$a.clone(true);
$(this).append($clone);
arr.push($clone[0]);
});
$a=$(arr);
}else{
$a.appendTo($p);
}}
opts.pagerAnchors=opts.pagerAnchors||[];
opts.pagerAnchors.push($a);
var pagerFn=function(e){
e.preventDefault();
opts.nextSlide=i;
var p=opts.$cont[0], timeout=p.cycleTimeout;
if(timeout){
clearTimeout(timeout);
p.cycleTimeout=0;
}
var cb=opts.onPagerEvent||opts.pagerClick;
if($.isFunction(cb))
cb(opts.nextSlide, els[opts.nextSlide]);
go(els,opts,1,opts.currSlide < i);
};
if(/mouseenter|mouseover/i.test(opts.pagerEvent)){
$a.hover(pagerFn, function(){});
}else{
$a.bind(opts.pagerEvent, pagerFn);
}
if(! /^click/.test(opts.pagerEvent)&&!opts.allowPagerClickBubble)
$a.bind('click.cycle', function(){return false;});
var cont=opts.$cont[0];
var pauseFlag=false;
if(opts.pauseOnPagerHover){
$a.hover(function(){
pauseFlag=true;
cont.cyclePause++;
triggerPause(cont,true,true);
}, function(){
if(pauseFlag)
cont.cyclePause--;
triggerPause(cont,true,true);
}
);
}};
$.fn.cycle.hopsFromLast=function(opts, fwd){
var hops, l=opts.lastSlide, c=opts.currSlide;
if(fwd)
hops=c > l ? c - l:opts.slideCount - l;
else
hops=c < l ? l - c:l + opts.slideCount - c;
return hops;
};
function clearTypeFix($slides){
debug('applying clearType background-color hack');
function hex(s){
s=parseInt(s,10).toString(16);
return s.length < 2 ? '0'+s:s;
}
function getBg(e){
for(; e&&e.nodeName.toLowerCase()!='html'; e=e.parentNode){
var v=$.css(e,'background-color');
if(v&&v.indexOf('rgb') >=0){
var rgb=v.match(/\d+/g);
return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);
}
if(v&&v!='transparent')
return v;
}
return '#ffffff';
}
$slides.each(function(){ $(this).css('background-color', getBg(this)); });
}
$.fn.cycle.commonReset=function(curr,next,opts,w,h,rev){
$(opts.elements).not(curr).hide();
if(typeof opts.cssBefore.opacity=='undefined')
opts.cssBefore.opacity=1;
opts.cssBefore.display='block';
if(opts.slideResize&&w!==false&&next.cycleW > 0)
opts.cssBefore.width=next.cycleW;
if(opts.slideResize&&h!==false&&next.cycleH > 0)
opts.cssBefore.height=next.cycleH;
opts.cssAfter=opts.cssAfter||{};
opts.cssAfter.display='none';
$(curr).css('zIndex',opts.slideCount + (rev===true ? 1:0));
$(next).css('zIndex',opts.slideCount + (rev===true ? 0:1));
};
$.fn.cycle.custom=function(curr, next, opts, cb, fwd, speedOverride){
var $l=$(curr), $n=$(next);
var speedIn=opts.speedIn, speedOut=opts.speedOut, easeIn=opts.easeIn, easeOut=opts.easeOut, animInDelay=opts.animInDelay, animOutDelay=opts.animOutDelay;
$n.css(opts.cssBefore);
if(speedOverride){
if(typeof speedOverride=='number')
speedIn=speedOut=speedOverride;
else
speedIn=speedOut=1;
easeIn=easeOut=null;
}
var fn=function(){
$n.delay(animInDelay).animate(opts.animIn, speedIn, easeIn, function(){
cb();
});
};
$l.delay(animOutDelay).animate(opts.animOut, speedOut, easeOut, function(){
$l.css(opts.cssAfter);
if(!opts.sync)
fn();
});
if(opts.sync) fn();
};
$.fn.cycle.transitions={
fade: function($cont, $slides, opts){
$slides.not(':eq('+opts.currSlide+')').css('opacity',0);
opts.before.push(function(curr,next,opts){
$.fn.cycle.commonReset(curr,next,opts);
opts.cssBefore.opacity=0;
});
opts.animIn={ opacity: 1 };
opts.animOut={ opacity: 0 };
opts.cssBefore={ top: 0, left: 0 };}};
$.fn.cycle.ver=function(){ return ver; };
$.fn.cycle.defaults={
activePagerClass: 'activeSlide',
after: null,
allowPagerClickBubble: false,
animIn: null,
animInDelay: 0,
animOut: null,
animOutDelay: 0,
aspect: false,
autostop: 0,
autostopCount: 0,
backwards: false,
before: null,
center: null,
cleartype: !$.support.opacity,
cleartypeNoBg: false,
containerResize: 1,
containerResizeHeight: 0,
continuous: 0,
cssAfter: null,
cssBefore: null,
delay: 0,
easeIn: null,
easeOut: null,
easing: null,
end: null,
fastOnEvent: 0,
fit: 0,
fx: 'fade',
fxFn: null,
height: 'auto',
manualTrump: true,
metaAttr: 'cycle',
next: null,
nowrap: 0,
onPagerEvent: null,
onPrevNextEvent: null,
pager: null,
pagerAnchorBuilder: null,
pagerEvent: 'click.cycle',
pause: 0,
pauseOnPagerHover: 0,
prev: null,
prevNextEvent: 'click.cycle',
random: 0,
randomizeEffects: 1,
requeueOnImageNotLoaded: true,
requeueTimeout: 250,
rev: 0,
shuffle: null,
skipInitializationCallbacks: false,
slideExpr: null,
slideResize: 1,
speed: 1000,
speedIn: null,
speedOut: null,
startingSlide: undefined,
sync: 1,
timeout: 4000,
timeoutFn: null,
updateActivePagerLink: null,
width: null
};})(jQuery);
(function($){
"use strict";
$.fn.cycle.transitions.none=function($cont, $slides, opts){
opts.fxFn=function(curr,next,opts,after){
$(next).show();
$(curr).hide();
after();
};};
$.fn.cycle.transitions.fadeout=function($cont, $slides, opts){
$slides.not(':eq('+opts.currSlide+')').css({ display: 'block', 'opacity': 1 });
opts.before.push(function(curr,next,opts,w,h,rev){
$(curr).css('zIndex',opts.slideCount + (rev!==true ? 1:0));
$(next).css('zIndex',opts.slideCount + (rev!==true ? 0:1));
});
opts.animIn.opacity=1;
opts.animOut.opacity=0;
opts.cssBefore.opacity=1;
opts.cssBefore.display='block';
opts.cssAfter.zIndex=0;
};
$.fn.cycle.transitions.scrollUp=function($cont, $slides, opts){
$cont.css('overflow','hidden');
opts.before.push($.fn.cycle.commonReset);
var h=$cont.height();
opts.cssBefore.top=h;
opts.cssBefore.left=0;
opts.cssFirst.top=0;
opts.animIn.top=0;
opts.animOut.top=-h;
};
$.fn.cycle.transitions.scrollDown=function($cont, $slides, opts){
$cont.css('overflow','hidden');
opts.before.push($.fn.cycle.commonReset);
var h=$cont.height();
opts.cssFirst.top=0;
opts.cssBefore.top=-h;
opts.cssBefore.left=0;
opts.animIn.top=0;
opts.animOut.top=h;
};
$.fn.cycle.transitions.scrollLeft=function($cont, $slides, opts){
$cont.css('overflow','hidden');
opts.before.push($.fn.cycle.commonReset);
var w=$cont.width();
opts.cssFirst.left=0;
opts.cssBefore.left=w;
opts.cssBefore.top=0;
opts.animIn.left=0;
opts.animOut.left=0-w;
};
$.fn.cycle.transitions.scrollRight=function($cont, $slides, opts){
$cont.css('overflow','hidden');
opts.before.push($.fn.cycle.commonReset);
var w=$cont.width();
opts.cssFirst.left=0;
opts.cssBefore.left=-w;
opts.cssBefore.top=0;
opts.animIn.left=0;
opts.animOut.left=w;
};
$.fn.cycle.transitions.scrollHorz=function($cont, $slides, opts){
$cont.css('overflow','hidden').width();
opts.before.push(function(curr, next, opts, fwd){
if(opts.rev)
fwd = !fwd;
$.fn.cycle.commonReset(curr,next,opts);
opts.cssBefore.left=fwd ? (next.cycleW-1):(1-next.cycleW);
opts.animOut.left=fwd ? -curr.cycleW:curr.cycleW;
});
opts.cssFirst.left=0;
opts.cssBefore.top=0;
opts.animIn.left=0;
opts.animOut.top=0;
};
$.fn.cycle.transitions.scrollVert=function($cont, $slides, opts){
$cont.css('overflow','hidden');
opts.before.push(function(curr, next, opts, fwd){
if(opts.rev)
fwd = !fwd;
$.fn.cycle.commonReset(curr,next,opts);
opts.cssBefore.top=fwd ? (1-next.cycleH):(next.cycleH-1);
opts.animOut.top=fwd ? curr.cycleH:-curr.cycleH;
});
opts.cssFirst.top=0;
opts.cssBefore.left=0;
opts.animIn.top=0;
opts.animOut.left=0;
};
$.fn.cycle.transitions.slideX=function($cont, $slides, opts){
opts.before.push(function(curr, next, opts){
$(opts.elements).not(curr).hide();
$.fn.cycle.commonReset(curr,next,opts,false,true);
opts.animIn.width=next.cycleW;
});
opts.cssBefore.left=0;
opts.cssBefore.top=0;
opts.cssBefore.width=0;
opts.animIn.width='show';
opts.animOut.width=0;
};
$.fn.cycle.transitions.slideY=function($cont, $slides, opts){
opts.before.push(function(curr, next, opts){
$(opts.elements).not(curr).hide();
$.fn.cycle.commonReset(curr,next,opts,true,false);
opts.animIn.height=next.cycleH;
});
opts.cssBefore.left=0;
opts.cssBefore.top=0;
opts.cssBefore.height=0;
opts.animIn.height='show';
opts.animOut.height=0;
};
$.fn.cycle.transitions.shuffle=function($cont, $slides, opts){
var i, w=$cont.css('overflow', 'visible').width();
$slides.css({left: 0, top: 0});
opts.before.push(function(curr,next,opts){
$.fn.cycle.commonReset(curr,next,opts,true,true,true);
});
if(!opts.speedAdjusted){
opts.speed=opts.speed / 2;
opts.speedAdjusted=true;
}
opts.random=0;
opts.shuffle=opts.shuffle||{left:-w, top:15};
opts.els=[];
for (i=0; i < $slides.length; i++)
opts.els.push($slides[i]);
for (i=0; i < opts.currSlide; i++)
opts.els.push(opts.els.shift());
opts.fxFn=function(curr, next, opts, cb, fwd){
if(opts.rev)
fwd = !fwd;
var $el=fwd ? $(curr):$(next);
$(next).css(opts.cssBefore);
var count=opts.slideCount;
$el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function(){
var hops=$.fn.cycle.hopsFromLast(opts, fwd);
for (var k=0; k < hops; k++){
if(fwd)
opts.els.push(opts.els.shift());
else
opts.els.unshift(opts.els.pop());
}
if(fwd){
for (var i=0, len=opts.els.length; i < len; i++)
$(opts.els[i]).css('z-index', len-i+count);
}else{
var z=$(curr).css('z-index');
$el.css('z-index', parseInt(z,10)+1+count);
}
$el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function(){
$(fwd ? this:curr).hide();
if(cb) cb();
});
});
};
$.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
};
$.fn.cycle.transitions.turnUp=function($cont, $slides, opts){
opts.before.push(function(curr, next, opts){
$.fn.cycle.commonReset(curr,next,opts,true,false);
opts.cssBefore.top=next.cycleH;
opts.animIn.height=next.cycleH;
opts.animOut.width=next.cycleW;
});
opts.cssFirst.top=0;
opts.cssBefore.left=0;
opts.cssBefore.height=0;
opts.animIn.top=0;
opts.animOut.height=0;
};
$.fn.cycle.transitions.turnDown=function($cont, $slides, opts){
opts.before.push(function(curr, next, opts){
$.fn.cycle.commonReset(curr,next,opts,true,false);
opts.animIn.height=next.cycleH;
opts.animOut.top=curr.cycleH;
});
opts.cssFirst.top=0;
opts.cssBefore.left=0;
opts.cssBefore.top=0;
opts.cssBefore.height=0;
opts.animOut.height=0;
};
$.fn.cycle.transitions.turnLeft=function($cont, $slides, opts){
opts.before.push(function(curr, next, opts){
$.fn.cycle.commonReset(curr,next,opts,false,true);
opts.cssBefore.left=next.cycleW;
opts.animIn.width=next.cycleW;
});
opts.cssBefore.top=0;
opts.cssBefore.width=0;
opts.animIn.left=0;
opts.animOut.width=0;
};
$.fn.cycle.transitions.turnRight=function($cont, $slides, opts){
opts.before.push(function(curr, next, opts){
$.fn.cycle.commonReset(curr,next,opts,false,true);
opts.animIn.width=next.cycleW;
opts.animOut.left=curr.cycleW;
});
$.extend(opts.cssBefore, { top: 0, left: 0, width: 0 });
opts.animIn.left=0;
opts.animOut.width=0;
};
$.fn.cycle.transitions.zoom=function($cont, $slides, opts){
opts.before.push(function(curr, next, opts){
$.fn.cycle.commonReset(curr,next,opts,false,false,true);
opts.cssBefore.top=next.cycleH/2;
opts.cssBefore.left=next.cycleW/2;
$.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH });
$.extend(opts.animOut, { width: 0, height: 0, top: curr.cycleH/2, left: curr.cycleW/2 });
});
opts.cssFirst.top=0;
opts.cssFirst.left=0;
opts.cssBefore.width=0;
opts.cssBefore.height=0;
};
$.fn.cycle.transitions.fadeZoom=function($cont, $slides, opts){
opts.before.push(function(curr, next, opts){
$.fn.cycle.commonReset(curr,next,opts,false,false);
opts.cssBefore.left=next.cycleW/2;
opts.cssBefore.top=next.cycleH/2;
$.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH });
});
opts.cssBefore.width=0;
opts.cssBefore.height=0;
opts.animOut.opacity=0;
};
$.fn.cycle.transitions.blindX=function($cont, $slides, opts){
var w=$cont.css('overflow','hidden').width();
opts.before.push(function(curr, next, opts){
$.fn.cycle.commonReset(curr,next,opts);
opts.animIn.width=next.cycleW;
opts.animOut.left=curr.cycleW;
});
opts.cssBefore.left=w;
opts.cssBefore.top=0;
opts.animIn.left=0;
opts.animOut.left=w;
};
$.fn.cycle.transitions.blindY=function($cont, $slides, opts){
var h=$cont.css('overflow','hidden').height();
opts.before.push(function(curr, next, opts){
$.fn.cycle.commonReset(curr,next,opts);
opts.animIn.height=next.cycleH;
opts.animOut.top=curr.cycleH;
});
opts.cssBefore.top=h;
opts.cssBefore.left=0;
opts.animIn.top=0;
opts.animOut.top=h;
};
$.fn.cycle.transitions.blindZ=function($cont, $slides, opts){
var h=$cont.css('overflow','hidden').height();
var w=$cont.width();
opts.before.push(function(curr, next, opts){
$.fn.cycle.commonReset(curr,next,opts);
opts.animIn.height=next.cycleH;
opts.animOut.top=curr.cycleH;
});
opts.cssBefore.top=h;
opts.cssBefore.left=w;
opts.animIn.top=0;
opts.animIn.left=0;
opts.animOut.top=h;
opts.animOut.left=w;
};
$.fn.cycle.transitions.growX=function($cont, $slides, opts){
opts.before.push(function(curr, next, opts){
$.fn.cycle.commonReset(curr,next,opts,false,true);
opts.cssBefore.left=this.cycleW/2;
opts.animIn.left=0;
opts.animIn.width=this.cycleW;
opts.animOut.left=0;
});
opts.cssBefore.top=0;
opts.cssBefore.width=0;
};
$.fn.cycle.transitions.growY=function($cont, $slides, opts){
opts.before.push(function(curr, next, opts){
$.fn.cycle.commonReset(curr,next,opts,true,false);
opts.cssBefore.top=this.cycleH/2;
opts.animIn.top=0;
opts.animIn.height=this.cycleH;
opts.animOut.top=0;
});
opts.cssBefore.height=0;
opts.cssBefore.left=0;
};
$.fn.cycle.transitions.curtainX=function($cont, $slides, opts){
opts.before.push(function(curr, next, opts){
$.fn.cycle.commonReset(curr,next,opts,false,true,true);
opts.cssBefore.left=next.cycleW/2;
opts.animIn.left=0;
opts.animIn.width=this.cycleW;
opts.animOut.left=curr.cycleW/2;
opts.animOut.width=0;
});
opts.cssBefore.top=0;
opts.cssBefore.width=0;
};
$.fn.cycle.transitions.curtainY=function($cont, $slides, opts){
opts.before.push(function(curr, next, opts){
$.fn.cycle.commonReset(curr,next,opts,true,false,true);
opts.cssBefore.top=next.cycleH/2;
opts.animIn.top=0;
opts.animIn.height=next.cycleH;
opts.animOut.top=curr.cycleH/2;
opts.animOut.height=0;
});
opts.cssBefore.height=0;
opts.cssBefore.left=0;
};
$.fn.cycle.transitions.cover=function($cont, $slides, opts){
var d=opts.direction||'left';
var w=$cont.css('overflow','hidden').width();
var h=$cont.height();
opts.before.push(function(curr, next, opts){
$.fn.cycle.commonReset(curr,next,opts);
opts.cssAfter.display='';
if(d=='right')
opts.cssBefore.left=-w;
else if(d=='up')
opts.cssBefore.top=h;
else if(d=='down')
opts.cssBefore.top=-h;
else
opts.cssBefore.left=w;
});
opts.animIn.left=0;
opts.animIn.top=0;
opts.cssBefore.top=0;
opts.cssBefore.left=0;
};
$.fn.cycle.transitions.uncover=function($cont, $slides, opts){
var d=opts.direction||'left';
var w=$cont.css('overflow','hidden').width();
var h=$cont.height();
opts.before.push(function(curr, next, opts){
$.fn.cycle.commonReset(curr,next,opts,true,true,true);
if(d=='right')
opts.animOut.left=w;
else if(d=='up')
opts.animOut.top=-h;
else if(d=='down')
opts.animOut.top=h;
else
opts.animOut.left=-w;
});
opts.animIn.left=0;
opts.animIn.top=0;
opts.cssBefore.top=0;
opts.cssBefore.left=0;
};
$.fn.cycle.transitions.toss=function($cont, $slides, opts){
var w=$cont.css('overflow','visible').width();
var h=$cont.height();
opts.before.push(function(curr, next, opts){
$.fn.cycle.commonReset(curr,next,opts,true,true,true);
if(!opts.animOut.left&&!opts.animOut.top)
$.extend(opts.animOut, { left: w*2, top: -h/2, opacity: 0 });
else
opts.animOut.opacity=0;
});
opts.cssBefore.left=0;
opts.cssBefore.top=0;
opts.animIn.left=0;
};
$.fn.cycle.transitions.wipe=function($cont, $slides, opts){
var w=$cont.css('overflow','hidden').width();
var h=$cont.height();
opts.cssBefore=opts.cssBefore||{};
var clip;
if(opts.clip){
if(/l2r/.test(opts.clip))
clip='rect(0px 0px '+h+'px 0px)';
else if(/r2l/.test(opts.clip))
clip='rect(0px '+w+'px '+h+'px '+w+'px)';
else if(/t2b/.test(opts.clip))
clip='rect(0px '+w+'px 0px 0px)';
else if(/b2t/.test(opts.clip))
clip='rect('+h+'px '+w+'px '+h+'px 0px)';
else if(/zoom/.test(opts.clip)){
var top=parseInt(h/2,10);
var left=parseInt(w/2,10);
clip='rect('+top+'px '+left+'px '+top+'px '+left+'px)';
}}
opts.cssBefore.clip=opts.cssBefore.clip||clip||'rect(0px 0px 0px 0px)';
var d=opts.cssBefore.clip.match(/(\d+)/g);
var t=parseInt(d[0],10), r=parseInt(d[1],10), b=parseInt(d[2],10), l=parseInt(d[3],10);
opts.before.push(function(curr, next, opts){
if(curr==next) return;
var $curr=$(curr), $next=$(next);
$.fn.cycle.commonReset(curr,next,opts,true,true,false);
opts.cssAfter.display='block';
var step=1, count=parseInt((opts.speedIn / 13),10) - 1;
(function f(){
var tt=t ? t - parseInt(step * (t/count),10):0;
var ll=l ? l - parseInt(step * (l/count),10):0;
var bb=b < h ? b + parseInt(step * ((h-b)/count||1),10):h;
var rr=r < w ? r + parseInt(step * ((w-r)/count||1),10):w;
$next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' });
(step++ <=count) ? setTimeout(f, 13):$curr.css('display', 'none');
})();
});
$.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
opts.animIn={ left: 0 };
opts.animOut={ left: 0 };};
})(jQuery);
jQuery.easing['jswing']=jQuery.easing['swing'];
jQuery.extend(jQuery.easing,
{
def: 'easeOutQuad',
swing: function (x, t, b, c, d){
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
},
easeInQuad: function (x, t, b, c, d){
return c*(t/=d)*t + b;
},
easeOutQuad: function (x, t, b, c, d){
return -c *(t/=d)*(t-2) + b;
},
easeInOutQuad: function (x, t, b, c, d){
if((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
},
easeInCubic: function (x, t, b, c, d){
return c*(t/=d)*t*t + b;
},
easeOutCubic: function (x, t, b, c, d){
return c*((t=t/d-1)*t*t + 1) + b;
},
easeInOutCubic: function (x, t, b, c, d){
if((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
},
easeInQuart: function (x, t, b, c, d){
return c*(t/=d)*t*t*t + b;
},
easeOutQuart: function (x, t, b, c, d){
return -c * ((t=t/d-1)*t*t*t - 1) + b;
},
easeInOutQuart: function (x, t, b, c, d){
if((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
easeInQuint: function (x, t, b, c, d){
return c*(t/=d)*t*t*t*t + b;
},
easeOutQuint: function (x, t, b, c, d){
return c*((t=t/d-1)*t*t*t*t + 1) + b;
},
easeInOutQuint: function (x, t, b, c, d){
if((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
},
easeInSine: function (x, t, b, c, d){
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
},
easeOutSine: function (x, t, b, c, d){
return c * Math.sin(t/d * (Math.PI/2)) + b;
},
easeInOutSine: function (x, t, b, c, d){
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
},
easeInExpo: function (x, t, b, c, d){
return (t==0) ? b:c * Math.pow(2, 10 * (t/d - 1)) + b;
},
easeOutExpo: function (x, t, b, c, d){
return (t==d) ? b+c:c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
easeInOutExpo: function (x, t, b, c, d){
if(t==0) return b;
if(t==d) return b+c;
if((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
},
easeInCirc: function (x, t, b, c, d){
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
},
easeOutCirc: function (x, t, b, c, d){
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
},
easeInOutCirc: function (x, t, b, c, d){
if((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
},
easeInElastic: function (x, t, b, c, d){
var s=1.70158;var p=0;var a=c;
if(t==0) return b; if((t/=d)==1) return b+c; if(!p) p=d*.3;
if(a < Math.abs(c)){ a=c; var s=p/4; }
else var s=p/(2*Math.PI) * Math.asin (c/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin((t*d-s)*(2*Math.PI)/p)) + b;
},
easeOutElastic: function (x, t, b, c, d){
var s=1.70158;var p=0;var a=c;
if(t==0) return b; if((t/=d)==1) return b+c; if(!p) p=d*.3;
if(a < Math.abs(c)){ a=c; var s=p/4; }
else var s=p/(2*Math.PI) * Math.asin (c/a);
return a*Math.pow(2,-10*t) * Math.sin((t*d-s)*(2*Math.PI)/p) + c + b;
},
easeInOutElastic: function (x, t, b, c, d){
var s=1.70158;var p=0;var a=c;
if(t==0) return b; if((t/=d/2)==2) return b+c; if(!p) p=d*(.3*1.5);
if(a < Math.abs(c)){ a=c; var s=p/4; }
else var s=p/(2*Math.PI) * Math.asin (c/a);
if(t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin((t*d-s)*(2*Math.PI)/p)) + b;
return a*Math.pow(2,-10*(t-=1)) * Math.sin((t*d-s)*(2*Math.PI)/p)*.5 + c + b;
},
easeInBack: function (x, t, b, c, d, s){
if(s==undefined) s=1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
},
easeOutBack: function (x, t, b, c, d, s){
if(s==undefined) s=1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
easeInOutBack: function (x, t, b, c, d, s){
if(s==undefined) s=1.70158;
if((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
easeInBounce: function (x, t, b, c, d){
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
},
easeOutBounce: function (x, t, b, c, d){
if((t/=d) < (1/2.75)){
return c*(7.5625*t*t) + b;
}else if(t < (2/2.75)){
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
}else if(t < (2.5/2.75)){
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
}else{
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}},
easeInOutBounce: function (x, t, b, c, d){
if(t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
}});
(function(window, $, undefined){
var $event=$.event, resizeTimeout;
$event.special.smartresize={
setup: function(){
$(this).bind("resize", $event.special.smartresize.handler);
},
teardown: function(){
$(this).unbind("resize", $event.special.smartresize.handler);
},
handler: function(event, execAsap){
var context=this,
args=arguments;
event.type="smartresize";
if(resizeTimeout){ clearTimeout(resizeTimeout); }
resizeTimeout=setTimeout(function(){
jQuery.event.handle.apply(context, args);
}, execAsap==="execAsap"? 0:100);
}};
$.fn.smartresize=function(fn){
return fn ? this.bind("smartresize", fn):this.trigger("smartresize", ["execAsap"]);
};
$.Slideshow=function(options, element){
this.$el=$(element);
this.$list=this.$el.find('ul.ei-slider-large');
this.$imgItems=this.$list.children('li');
this.itemsCount=this.$imgItems.length;
this.$images=this.$imgItems.find('img:first');
this.$sliderthumbs=this.$el.find('ul.ei-slider-thumbs').hide();
this.$sliderElems=this.$sliderthumbs.children('li');
this.$sliderElem=this.$sliderthumbs.children('li.ei-slider-element');
this.$thumbs=this.$sliderElems.not('.ei-slider-element');
this._init(options);
};
$.Slideshow.defaults={
animation:'sides',
autoplay:false,
slideshow_interval:3000,
speed:800,
easing:'',
titlesFactor:0.60,
titlespeed:800,
titleeasing:'',
thumbMaxWidth:150
};
$.Slideshow.prototype={
_init:function(options){
this.options=$.extend(true, {}, $.Slideshow.defaults, options);
this.$imgItems.css('opacity', 0);
this.$imgItems.find('div.ei-title > *').css('opacity', 0);
this.current=0;
var _self=this;
this.$loading=$('Loading
').prependTo(_self.$el);
$.when(this._preloadImages()).done(function(){
_self.$loading.hide();
_self._setImagesSize();
_self._initThumbs();
_self.$imgItems.eq(_self.current).css({
'opacity':1,
'z-index':10
}).show().find('div.ei-title > *').css('opacity', 1);
if(_self.options.autoplay){
_self._startSlideshow();
}
_self._initEvents();
});
},
_preloadImages:function(){
var _self=this,
loaded=0;
return $.Deferred(function(dfd){
_self.$images.each(function(i){
$('').load(function(){
if(++loaded===_self.itemsCount){
dfd.resolve();
}}).attr('src', $(this).attr('src'));
});
}
).promise();
},
_setImagesSize:function(){
this.elWidth=this.$el.width();
var _self=this;
this.$images.each(function(i){
var $img=$(this);
imgDim=_self._getImageDim($img.attr('src'));
$img.css({
width:imgDim.width,
height:imgDim.height,
marginLeft:imgDim.left,
marginTop:imgDim.top
});
});
},
_getImageDim:function(src){
var $img=new Image();
$img.src=src;
var c_w=this.elWidth,
c_h=this.$el.height(),
r_w=c_h / c_w,
i_w=$img.width,
i_h=$img.height,
r_i=i_h / i_w,
new_w, new_h, new_left, new_top;
if(r_w > r_i){
new_h=c_h;
new_w=c_h / r_i;
}else{
new_h=c_w * r_i;
new_w=c_w;
}
return {
width:new_w,
height:new_h,
left:(c_w - new_w) / 2,
top:(c_h - new_h) / 2
};},
_initThumbs:function(){
this.$sliderElems.css({
'max-width':this.options.thumbMaxWidth + 'px',
'width':100 / this.itemsCount + '%'
});
this.$sliderthumbs.css('max-width', this.options.thumbMaxWidth * this.itemsCount + 'px').show();
},
_startSlideshow:function(){
var _self=this;
this.slideshow=setTimeout(function(){
var pos;
(_self.current===_self.itemsCount - 1) ? pos=0:pos=_self.current + 1;
_self._slideTo(pos);
if(_self.options.autoplay){
_self._startSlideshow();
}}, this.options.slideshow_interval);
},
_slideTo:function(pos){
if(pos===this.current||this.isAnimating)
return false;
this.isAnimating=true;
var $currentSlide=this.$imgItems.eq(this.current),
$nextSlide=this.$imgItems.eq(pos),
_self=this,
preCSS={zIndex:10},
animCSS={opacity:1};
if(this.options.animation==='sides'){
preCSS.left=(pos > this.current) ? -1 * this.elWidth:this.elWidth;
animCSS.left=0;
}
$nextSlide.find('div.ei-title > h2')
.css('margin-right', 50 + 'px')
.stop()
.delay(this.options.speed * this.options.titlesFactor)
.animate({ marginRight:0 + 'px', opacity:1 }, this.options.titlespeed, this.options.titleeasing)
.end()
.find('div.ei-title > h3')
.css('margin-right', -50 + 'px')
.stop()
.delay(this.options.speed * this.options.titlesFactor)
.animate({ marginRight:0 + 'px', opacity:1 }, this.options.titlespeed, this.options.titleeasing);
$.when($currentSlide.css('z-index' , 1).find('div.ei-title > *').stop().fadeOut(this.options.speed / 2, function(){
$(this).show().css('opacity', 0);
}),
$nextSlide.css(preCSS).stop().animate(animCSS, this.options.speed, this.options.easing),
this.$sliderElem.stop().animate({
left:this.$thumbs.eq(pos).position().left
}, this.options.speed)
).done(function(){
$currentSlide.css('opacity' , 0).find('div.ei-title > *').css('opacity', 0);
_self.current=pos;
_self.isAnimating=false;
});
},
_initEvents:function(){
var _self=this;
$(window).on('smartresize.eislideshow', function(event){
_self._setImagesSize();
_self.$sliderElem.css('left', _self.$thumbs.eq(_self.current).position().left);
});
this.$thumbs.on('click.eislideshow', function(event){
if(_self.options.autoplay){
clearTimeout(_self.slideshow);
_self.options.autoplay=false;
}
var $thumb=$(this),
idx=$thumb.index() - 1;
_self._slideTo(idx);
return false;
});
}};
var logError=function(message){
if(this.console){
console.error(message);
}};
$.fn.eislideshow=function(options){
if(typeof options==='string'){
var args=Array.prototype.slice.call(arguments, 1);
this.each(function(){
var instance=$.data(this, 'eislideshow');
if(!instance){
logError("cannot call methods on eislideshow prior to initialization; " +
"attempted to call method '" + options + "'");
return;
}
if(!$.isFunction(instance[options])||options.charAt(0)==="_"){
logError("no such method '" + options + "' for eislideshow instance");
return;
}
instance[ options ].apply(instance, args);
});
}else{
this.each(function(){
var instance=$.data(this, 'eislideshow');
if(!instance){
$.data(this, 'eislideshow', new $.Slideshow(options, this));
}});
}
return this;
};})(window, jQuery);
;(function($){
'use strict';
$.fn.fitVids=function(options){
var settings={
customSelector: null,
ignore: null
};
if(!document.getElementById('fit-vids-style')){
var head=document.head||document.getElementsByTagName('head')[0];
var css='.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';
var div=document.createElement("div");
div.innerHTML='x
';
head.appendChild(div.childNodes[1]);
}
if(options){
$.extend(settings, options);
}
return this.each(function(){
var selectors=[
'iframe[src*="player.vimeo.com"]',
'iframe[src*="youtube.com"]',
'iframe[src*="youtube-nocookie.com"]',
'iframe[src*="kickstarter.com"][src*="video.html"]',
'object',
'embed'
];
if(settings.customSelector){
selectors.push(settings.customSelector);
}
var ignoreList='.fitvidsignore';
if(settings.ignore){
ignoreList=ignoreList + ', ' + settings.ignore;
}
var $allVideos=$(this).find(selectors.join(','));
$allVideos=$allVideos.not('object object');
$allVideos=$allVideos.not(ignoreList);
$allVideos.each(function(){
var $this=$(this);
if($this.parents(ignoreList).length > 0){
return;
}
if(this.tagName.toLowerCase()==='embed'&&$this.parent('object').length||$this.parent('.fluid-width-video-wrapper').length){ return; }
if((!$this.css('height')&&!$this.css('width'))&&(isNaN($this.attr('height'))||isNaN($this.attr('width')))){
$this.attr('height', 9);
$this.attr('width', 16);
}
var height=(this.tagName.toLowerCase()==='object'||($this.attr('height')&&!isNaN(parseInt($this.attr('height'), 10)))) ? parseInt($this.attr('height'), 10):$this.height(),
width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10):$this.width(),
aspectRatio=height / width;
if(!$this.attr('name')){
var videoName='fitvid' + $.fn.fitVids._count;
$this.attr('name', videoName);
$.fn.fitVids._count++;
}
$this.wrap('').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%');
$this.removeAttr('height').removeAttr('width');
});
});
};
$.fn.fitVids._count=0;
})(window.jQuery||window.Zepto);
;
(function ($){
$.flexslider=function(el, options){
var slider=$(el);
slider.vars=$.extend({}, $.flexslider.defaults, options);
var namespace=slider.vars.namespace,
msGesture=window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture,
touch=(("ontouchstart" in window)||msGesture||window.DocumentTouch&&document instanceof DocumentTouch)&&slider.vars.touch,
eventType="click touchend MSPointerUp",
watchedEvent="",
watchedEventClearTimer,
vertical=slider.vars.direction==="vertical",
reverse=slider.vars.reverse,
carousel=(slider.vars.itemWidth > 0),
fade=slider.vars.animation==="fade",
asNav=slider.vars.asNavFor!=="",
methods={},
focused=true;
$.data(el, "flexslider", slider);
methods={
init: function(){
slider.animating=false;
slider.currentSlide=parseInt(( slider.vars.startAt ? slider.vars.startAt:0), 10);
if(isNaN(slider.currentSlide)) slider.currentSlide=0;
slider.animatingTo=slider.currentSlide;
slider.atEnd=(slider.currentSlide===0||slider.currentSlide===slider.last);
slider.containerSelector=slider.vars.selector.substr(0,slider.vars.selector.search(' '));
slider.slides=$(slider.vars.selector, slider);
slider.container=$(slider.containerSelector, slider);
slider.count=slider.slides.length;
slider.syncExists=$(slider.vars.sync).length > 0;
if(slider.vars.animation==="slide") slider.vars.animation="swing";
slider.prop=(vertical) ? "top":"marginLeft";
slider.args={};
slider.manualPause=false;
slider.stopped=false;
slider.started=false;
slider.startTimeout=null;
slider.transitions = !slider.vars.video&&!fade&&slider.vars.useCSS&&(function(){
var obj=document.createElement('div'),
props=['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
for (var i in props){
if(obj.style[ props[i] ]!==undefined){
slider.pfx=props[i].replace('Perspective','').toLowerCase();
slider.prop="-" + slider.pfx + "-transform";
return true;
}}
return false;
}());
slider.ensureAnimationEnd='';
if(slider.vars.controlsContainer!=="") slider.controlsContainer=$(slider.vars.controlsContainer).length > 0&&$(slider.vars.controlsContainer);
if(slider.vars.manualControls!=="") slider.manualControls=$(slider.vars.manualControls).length > 0&&$(slider.vars.manualControls);
if(slider.vars.randomize){
slider.slides.sort(function(){ return (Math.round(Math.random())-0.5); });
slider.container.empty().append(slider.slides);
}
slider.doMath();
slider.setup("init");
if(slider.vars.controlNav) methods.controlNav.setup();
if(slider.vars.directionNav) methods.directionNav.setup();
if(slider.vars.keyboard&&($(slider.containerSelector).length===1||slider.vars.multipleKeyboard)){
$(document).bind('keyup', function(event){
var keycode=event.keyCode;
if(!slider.animating&&(keycode===39||keycode===37)){
var target=(keycode===39) ? slider.getTarget('next') :
(keycode===37) ? slider.getTarget('prev'):false;
slider.flexAnimate(target, slider.vars.pauseOnAction);
}});
}
if(slider.vars.mousewheel){
slider.bind('mousewheel', function(event, delta, deltaX, deltaY){
event.preventDefault();
var target=(delta < 0) ? slider.getTarget('next'):slider.getTarget('prev');
slider.flexAnimate(target, slider.vars.pauseOnAction);
});
}
if(slider.vars.pausePlay) methods.pausePlay.setup();
if(slider.vars.slideshow&&slider.vars.pauseInvisible) methods.pauseInvisible.init();
if(slider.vars.slideshow){
if(slider.vars.pauseOnHover){
slider.hover(function(){
if(!slider.manualPlay&&!slider.manualPause) slider.pause();
}, function(){
if(!slider.manualPause&&!slider.manualPlay&&!slider.stopped) slider.play();
});
}
if(!slider.vars.pauseInvisible||!methods.pauseInvisible.isHidden()){
(slider.vars.initDelay > 0) ? slider.startTimeout=setTimeout(slider.play, slider.vars.initDelay):slider.play();
}}
if(asNav) methods.asNav.setup();
if(touch&&slider.vars.touch) methods.touch();
if(!fade||(fade&&slider.vars.smoothHeight)) $(window).bind("resize orientationchange focus", methods.resize);
slider.find("img").attr("draggable", "false");
setTimeout(function(){
slider.vars.start(slider);
}, 200);
},
asNav: {
setup: function(){
slider.asNav=true;
slider.animatingTo=Math.floor(slider.currentSlide/slider.move);
slider.currentItem=slider.currentSlide;
slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide");
if(!msGesture){
slider.slides.on(eventType, function(e){
e.preventDefault();
var $slide=$(this),
target=$slide.index();
var posFromLeft=$slide.offset().left - $(slider).scrollLeft();
if(posFromLeft <=0&&$slide.hasClass(namespace + 'active-slide')){
slider.flexAnimate(slider.getTarget("prev"), true);
}else if(!$(slider.vars.asNavFor).data('flexslider').animating&&!$slide.hasClass(namespace + "active-slide")){
slider.direction=(slider.currentItem < target) ? "next":"prev";
slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
}});
}else{
el._slider=slider;
slider.slides.each(function (){
var that=this;
that._gesture=new MSGesture();
that._gesture.target=that;
that.addEventListener("MSPointerDown", function (e){
e.preventDefault();
if(e.currentTarget._gesture)
e.currentTarget._gesture.addPointer(e.pointerId);
}, false);
that.addEventListener("MSGestureTap", function (e){
e.preventDefault();
var $slide=$(this),
target=$slide.index();
if(!$(slider.vars.asNavFor).data('flexslider').animating&&!$slide.hasClass('active')){
slider.direction=(slider.currentItem < target) ? "next":"prev";
slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
}});
});
}}
},
controlNav: {
setup: function(){
if(!slider.manualControls){
methods.controlNav.setupPaging();
}else{
methods.controlNav.setupManual();
}},
setupPaging: function(){
var type=(slider.vars.controlNav==="thumbnails") ? 'control-thumbs':'control-paging',
j=1,
item,
slide;
slider.controlNavScaffold=$('
');
if(slider.pagingCount > 1){
for (var i=0; i < slider.pagingCount; i++){
slide=slider.slides.eq(i);
item=(slider.vars.controlNav==="thumbnails") ? '':'' + j + '';
if('thumbnails'===slider.vars.controlNav&&true===slider.vars.thumbCaptions){
var captn=slide.attr('data-thumbcaption');
if(''!=captn&&undefined!=captn) item +='' + captn + '';
}
slider.controlNavScaffold.append('' + item + '');
j++;
}}
(slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold):slider.append(slider.controlNavScaffold);
methods.controlNav.set();
methods.controlNav.active();
slider.controlNavScaffold.delegate('a, img', eventType, function(event){
event.preventDefault();
if(watchedEvent===""||watchedEvent===event.type){
var $this=$(this),
target=slider.controlNav.index($this);
if(!$this.hasClass(namespace + 'active')){
slider.direction=(target > slider.currentSlide) ? "next":"prev";
slider.flexAnimate(target, slider.vars.pauseOnAction);
}}
if(watchedEvent===""){
watchedEvent=event.type;
}
methods.setToClearWatchedEvent();
});
},
setupManual: function(){
slider.controlNav=slider.manualControls;
methods.controlNav.active();
slider.controlNav.bind(eventType, function(event){
event.preventDefault();
if(watchedEvent===""||watchedEvent===event.type){
var $this=$(this),
target=slider.controlNav.index($this);
if(!$this.hasClass(namespace + 'active')){
(target > slider.currentSlide) ? slider.direction="next":slider.direction="prev";
slider.flexAnimate(target, slider.vars.pauseOnAction);
}}
if(watchedEvent===""){
watchedEvent=event.type;
}
methods.setToClearWatchedEvent();
});
},
set: function(){
var selector=(slider.vars.controlNav==="thumbnails") ? 'img':'a';
slider.controlNav=$('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer:slider);
},
active: function(){
slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active");
},
update: function(action, pos){
if(slider.pagingCount > 1&&action==="add"){
slider.controlNavScaffold.append($('' + slider.count + ''));
}else if(slider.pagingCount===1){
slider.controlNavScaffold.find('li').remove();
}else{
slider.controlNav.eq(pos).closest('li').remove();
}
methods.controlNav.set();
(slider.pagingCount > 1&&slider.pagingCount!==slider.controlNav.length) ? slider.update(pos, action):methods.controlNav.active();
}},
directionNav: {
setup: function(){
var directionNavScaffold=$('');
if(slider.controlsContainer){
$(slider.controlsContainer).append(directionNavScaffold);
slider.directionNav=$('.' + namespace + 'direction-nav li a', slider.controlsContainer);
}else{
slider.append(directionNavScaffold);
slider.directionNav=$('.' + namespace + 'direction-nav li a', slider);
}
methods.directionNav.update();
slider.directionNav.bind(eventType, function(event){
event.preventDefault();
var target;
if(watchedEvent===""||watchedEvent===event.type){
target=($(this).hasClass(namespace + 'next')) ? slider.getTarget('next'):slider.getTarget('prev');
slider.flexAnimate(target, slider.vars.pauseOnAction);
}
if(watchedEvent===""){
watchedEvent=event.type;
}
methods.setToClearWatchedEvent();
});
},
update: function(){
var disabledClass=namespace + 'disabled';
if(slider.pagingCount===1){
slider.directionNav.addClass(disabledClass).attr('tabindex', '-1');
}else if(!slider.vars.animationLoop){
if(slider.animatingTo===0){
slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass).attr('tabindex', '-1');
}else if(slider.animatingTo===slider.last){
slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass).attr('tabindex', '-1');
}else{
slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
}}else{
slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
}}
},
pausePlay: {
setup: function(){
var pausePlayScaffold=$('');
if(slider.controlsContainer){
slider.controlsContainer.append(pausePlayScaffold);
slider.pausePlay=$('.' + namespace + 'pauseplay a', slider.controlsContainer);
}else{
slider.append(pausePlayScaffold);
slider.pausePlay=$('.' + namespace + 'pauseplay a', slider);
}
methods.pausePlay.update((slider.vars.slideshow) ? namespace + 'pause':namespace + 'play');
slider.pausePlay.bind(eventType, function(event){
event.preventDefault();
if(watchedEvent===""||watchedEvent===event.type){
if($(this).hasClass(namespace + 'pause')){
slider.manualPause=true;
slider.manualPlay=false;
slider.pause();
}else{
slider.manualPause=false;
slider.manualPlay=true;
slider.play();
}}
if(watchedEvent===""){
watchedEvent=event.type;
}
methods.setToClearWatchedEvent();
});
},
update: function(state){
(state==="play") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').html(slider.vars.playText):slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').html(slider.vars.pauseText);
}},
touch: function(){
var startX,
startY,
offset,
cwidth,
dx,
startT,
scrolling=false,
localX=0,
localY=0,
accDx=0;
if(!msGesture){
function onTouchStart(e){
if(slider.animating){
e.preventDefault();
}else if(( window.navigator.msPointerEnabled)||e.touches.length===1){
slider.pause();
cwidth=(vertical) ? slider.h:slider. w;
startT=Number(new Date());
localX=e.touches[0].pageX;
localY=e.touches[0].pageY;
offset=(carousel&&reverse&&slider.animatingTo===slider.last) ? 0 :
(carousel&&reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
(carousel&&slider.currentSlide===slider.last) ? slider.limit :
(carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
(reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth:(slider.currentSlide + slider.cloneOffset) * cwidth;
startX=(vertical) ? localY:localX;
startY=(vertical) ? localX:localY;
el.addEventListener('touchmove', onTouchMove, false);
el.addEventListener('touchend', onTouchEnd, false);
}}
function onTouchMove(e){
localX=e.touches[0].pageX;
localY=e.touches[0].pageY;
dx=(vertical) ? startX - localY:startX - localX;
scrolling=(vertical) ? (Math.abs(dx) < Math.abs(localX - startY)):(Math.abs(dx) < Math.abs(localY - startY));
var fxms=500;
if(! scrolling||Number(new Date()) - startT > fxms){
e.preventDefault();
if(!fade&&slider.transitions){
if(!slider.vars.animationLoop){
dx=dx/((slider.currentSlide===0&&dx < 0||slider.currentSlide===slider.last&&dx > 0) ? (Math.abs(dx)/cwidth+2):1);
}
slider.setProps(offset + dx, "setTouch");
}}
}
function onTouchEnd(e){
el.removeEventListener('touchmove', onTouchMove, false);
if(slider.animatingTo===slider.currentSlide&&!scrolling&&!(dx===null)){
var updateDx=(reverse) ? -dx:dx,
target=(updateDx > 0) ? slider.getTarget('next'):slider.getTarget('prev');
if(slider.canAdvance(target)&&(Number(new Date()) - startT < 550&&Math.abs(updateDx) > 50||Math.abs(updateDx) > cwidth/2)){
slider.flexAnimate(target, slider.vars.pauseOnAction);
}else{
if(!fade) slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true);
}}
el.removeEventListener('touchend', onTouchEnd, false);
startX=null;
startY=null;
dx=null;
offset=null;
}
el.addEventListener('touchstart', onTouchStart, false);
}else{
function onMSPointerDown(e){
e.stopPropagation();
if(slider.animating){
e.preventDefault();
}else{
slider.pause();
el._gesture.addPointer(e.pointerId);
accDx=0;
cwidth=(vertical) ? slider.h:slider. w;
startT=Number(new Date());
offset=(carousel&&reverse&&slider.animatingTo===slider.last) ? 0 :
(carousel&&reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
(carousel&&slider.currentSlide===slider.last) ? slider.limit :
(carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
(reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth:(slider.currentSlide + slider.cloneOffset) * cwidth;
}}
function onMSGestureChange(e){
e.stopPropagation();
var slider=e.target._slider;
if(!slider){
return;
}
var transX=-e.translationX,
transY=-e.translationY;
accDx=accDx + ((vertical) ? transY:transX);
dx=accDx;
scrolling=(vertical) ? (Math.abs(accDx) < Math.abs(-transX)):(Math.abs(accDx) < Math.abs(-transY));
if(e.detail===e.MSGESTURE_FLAG_INERTIA){
setImmediate(function (){
el._gesture.stop();
});
return;
}
if(!scrolling||Number(new Date()) - startT > 500){
e.preventDefault();
if(!fade&&slider.transitions){
if(!slider.vars.animationLoop){
dx=accDx / ((slider.currentSlide===0&&accDx < 0||slider.currentSlide===slider.last&&accDx > 0) ? (Math.abs(accDx) / cwidth + 2):1);
}
slider.setProps(offset + dx, "setTouch");
}}
}
function onMSGestureEnd(e){
e.stopPropagation();
var slider=e.target._slider;
if(!slider){
return;
}
if(slider.animatingTo===slider.currentSlide&&!scrolling&&!(dx===null)){
var updateDx=(reverse) ? -dx:dx,
target=(updateDx > 0) ? slider.getTarget('next'):slider.getTarget('prev');
if(slider.canAdvance(target)&&(Number(new Date()) - startT < 550&&Math.abs(updateDx) > 50||Math.abs(updateDx) > cwidth/2)){
slider.flexAnimate(target, slider.vars.pauseOnAction);
}else{
if(!fade) slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true);
}}
startX=null;
startY=null;
dx=null;
offset=null;
accDx=0;
}
el.style.msTouchAction="pan-y";
el._gesture=new MSGesture();
el._gesture.target=el;
el.addEventListener("MSPointerDown", onMSPointerDown, false);
el._slider=slider;
el.addEventListener("MSGestureChange", onMSGestureChange, false);
el.addEventListener("MSGestureEnd", onMSGestureEnd, false);
}},
resize: function(){
if(!slider.animating&&slider.is(':visible')){
if(!carousel) slider.doMath();
if(fade){
methods.smoothHeight();
}else if(carousel){
slider.slides.width(slider.computedW);
slider.update(slider.pagingCount);
slider.setProps();
}
else if(vertical){
slider.viewport.height(slider.h);
slider.setProps(slider.h, "setTotal");
}else{
if(slider.vars.smoothHeight) methods.smoothHeight();
slider.newSlides.width(slider.computedW);
slider.setProps(slider.computedW, "setTotal");
}}
},
smoothHeight: function(dur){
if(!vertical||fade){
var $obj=(fade) ? slider:slider.viewport;
(dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).height()}, dur):$obj.height(slider.slides.eq(slider.animatingTo).height());
}},
sync: function(action){
var $obj=$(slider.vars.sync).data("flexslider"),
target=slider.animatingTo;
switch (action){
case "animate": $obj.flexAnimate(target, slider.vars.pauseOnAction, false, true); break;
case "play": if(!$obj.playing&&!$obj.asNav){ $obj.play(); } break;
case "pause": $obj.pause(); break;
}},
uniqueID: function($clone){
$clone.find('[id]').each(function(){
var $this=$(this);
$this.attr('id', $this.attr('id') + '_clone');
});
return $clone;
},
pauseInvisible: {
visProp: null,
init: function(){
var prefixes=['webkit','moz','ms','o'];
if('hidden' in document) return 'hidden';
for (var i=0; i < prefixes.length; i++){
if((prefixes[i] + 'Hidden') in document)
methods.pauseInvisible.visProp=prefixes[i] + 'Hidden';
}
if(methods.pauseInvisible.visProp){
var evtname=methods.pauseInvisible.visProp.replace(/[H|h]idden/,'') + 'visibilitychange';
document.addEventListener(evtname, function(){
if(methods.pauseInvisible.isHidden()){
if(slider.startTimeout) clearTimeout(slider.startTimeout);
else slider.pause();
}else{
if(slider.started) slider.play();
else (slider.vars.initDelay > 0) ? setTimeout(slider.play, slider.vars.initDelay):slider.play();
}});
}},
isHidden: function(){
return document[methods.pauseInvisible.visProp]||false;
}},
setToClearWatchedEvent: function(){
clearTimeout(watchedEventClearTimer);
watchedEventClearTimer=setTimeout(function(){
watchedEvent="";
}, 3000);
}};
slider.flexAnimate=function(target, pause, override, withSync, fromNav){
if(!slider.vars.animationLoop&&target!==slider.currentSlide){
slider.direction=(target > slider.currentSlide) ? "next":"prev";
}
if(asNav&&slider.pagingCount===1) slider.direction=(slider.currentItem < target) ? "next":"prev";
if(!slider.animating&&(slider.canAdvance(target, fromNav)||override)&&slider.is(":visible")){
if(asNav&&withSync){
var master=$(slider.vars.asNavFor).data('flexslider');
slider.atEnd=target===0||target===slider.count - 1;
master.flexAnimate(target, true, false, true, fromNav);
slider.direction=(slider.currentItem < target) ? "next":"prev";
master.direction=slider.direction;
if(Math.ceil((target + 1)/slider.visible) - 1!==slider.currentSlide&&target!==0){
slider.currentItem=target;
slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
target=Math.floor(target/slider.visible);
}else{
slider.currentItem=target;
slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
return false;
}}
slider.animating=true;
slider.animatingTo=target;
if(pause) slider.pause();
slider.vars.before(slider);
if(slider.syncExists&&!fromNav) methods.sync("animate");
if(slider.vars.controlNav) methods.controlNav.active();
if(!carousel) slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide');
slider.atEnd=target===0||target===slider.last;
if(slider.vars.directionNav) methods.directionNav.update();
if(target===slider.last){
slider.vars.end(slider);
if(!slider.vars.animationLoop) slider.pause();
}
if(!fade){
var dimension=(vertical) ? slider.slides.filter(':first').height():slider.computedW,
margin, slideString, calcNext;
if(carousel){
margin=slider.vars.itemMargin;
calcNext=((slider.itemW + margin) * slider.move) * slider.animatingTo;
slideString=(calcNext > slider.limit&&slider.visible!==1) ? slider.limit:calcNext;
}else if(slider.currentSlide===0&&target===slider.count - 1&&slider.vars.animationLoop&&slider.direction!=="next"){
slideString=(reverse) ? (slider.count + slider.cloneOffset) * dimension:0;
}else if(slider.currentSlide===slider.last&&target===0&&slider.vars.animationLoop&&slider.direction!=="prev"){
slideString=(reverse) ? 0:(slider.count + 1) * dimension;
}else{
slideString=(reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension:(target + slider.cloneOffset) * dimension;
}
slider.setProps(slideString, "", slider.vars.animationSpeed);
if(slider.transitions){
if(!slider.vars.animationLoop||!slider.atEnd){
slider.animating=false;
slider.currentSlide=slider.animatingTo;
}
slider.container.unbind("webkitTransitionEnd transitionend");
slider.container.bind("webkitTransitionEnd transitionend", function(){
clearTimeout(slider.ensureAnimationEnd);
slider.wrapup(dimension);
});
clearTimeout(slider.ensureAnimationEnd);
slider.ensureAnimationEnd=setTimeout(function(){
slider.wrapup(dimension);
}, slider.vars.animationSpeed + 100);
}else{
slider.container.animate(slider.args, slider.vars.animationSpeed, slider.vars.easing, function(){
slider.wrapup(dimension);
});
}}else{
if(!touch){
slider.slides.eq(slider.currentSlide).css({"zIndex": 1}).animate({"opacity": 0}, slider.vars.animationSpeed, slider.vars.easing);
slider.slides.eq(target).css({"zIndex": 2}).animate({"opacity": 1}, slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
}else{
slider.slides.eq(slider.currentSlide).css({ "opacity": 0, "zIndex": 1 });
slider.slides.eq(target).css({ "opacity": 1, "zIndex": 2 });
slider.wrapup(dimension);
}}
if(slider.vars.smoothHeight) methods.smoothHeight(slider.vars.animationSpeed);
}};
slider.wrapup=function(dimension){
if(!fade&&!carousel){
if(slider.currentSlide===0&&slider.animatingTo===slider.last&&slider.vars.animationLoop){
slider.setProps(dimension, "jumpEnd");
}else if(slider.currentSlide===slider.last&&slider.animatingTo===0&&slider.vars.animationLoop){
slider.setProps(dimension, "jumpStart");
}}
slider.animating=false;
slider.currentSlide=slider.animatingTo;
slider.vars.after(slider);
};
slider.animateSlides=function(){
if(!slider.animating&&focused) slider.flexAnimate(slider.getTarget("next"));
};
slider.pause=function(){
clearInterval(slider.animatedSlides);
slider.animatedSlides=null;
slider.playing=false;
if(slider.vars.pausePlay) methods.pausePlay.update("play");
if(slider.syncExists) methods.sync("pause");
};
slider.play=function(){
if(slider.playing) clearInterval(slider.animatedSlides);
slider.animatedSlides=slider.animatedSlides||setInterval(slider.animateSlides, slider.vars.slideshowSpeed);
slider.started=slider.playing=true;
if(slider.vars.pausePlay) methods.pausePlay.update("pause");
if(slider.syncExists) methods.sync("play");
};
slider.stop=function (){
slider.pause();
slider.stopped=true;
};
slider.canAdvance=function(target, fromNav){
var last=(asNav) ? slider.pagingCount - 1:slider.last;
return (fromNav) ? true :
(asNav&&slider.currentItem===slider.count - 1&&target===0&&slider.direction==="prev") ? true :
(asNav&&slider.currentItem===0&&target===slider.pagingCount - 1&&slider.direction!=="next") ? false :
(target===slider.currentSlide&&!asNav) ? false :
(slider.vars.animationLoop) ? true :
(slider.atEnd&&slider.currentSlide===0&&target===last&&slider.direction!=="next") ? false :
(slider.atEnd&&slider.currentSlide===last&&target===0&&slider.direction==="next") ? false :
true;
};
slider.getTarget=function(dir){
slider.direction=dir;
if(dir==="next"){
return (slider.currentSlide===slider.last) ? 0:slider.currentSlide + 1;
}else{
return (slider.currentSlide===0) ? slider.last:slider.currentSlide - 1;
}};
slider.setProps=function(pos, special, dur){
var target=(function(){
var posCheck=(pos) ? pos:((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo,
posCalc=(function(){
if(carousel){
return (special==="setTouch") ? pos :
(reverse&&slider.animatingTo===slider.last) ? 0 :
(reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
(slider.animatingTo===slider.last) ? slider.limit:posCheck;
}else{
switch (special){
case "setTotal": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos:(slider.currentSlide + slider.cloneOffset) * pos;
case "setTouch": return (reverse) ? pos:pos;
case "jumpEnd": return (reverse) ? pos:slider.count * pos;
case "jumpStart": return (reverse) ? slider.count * pos:pos;
default: return pos;
}}
}());
return (posCalc * -1) + "px";
}());
if(slider.transitions){
target=(vertical) ? "translate3d(0," + target + ",0)":"translate3d(" + target + ",0,0)";
dur=(dur!==undefined) ? (dur/1000) + "s":"0s";
slider.container.css("-" + slider.pfx + "-transition-duration", dur);
slider.container.css("transition-duration", dur);
}
slider.args[slider.prop]=target;
if(slider.transitions||dur===undefined) slider.container.css(slider.args);
slider.container.css('transform',target);
};
slider.setup=function(type){
if(!fade){
var sliderOffset, arr;
if(type==="init"){
slider.viewport=$('').css({"overflow": "hidden", "position": "relative"}).appendTo(slider).append(slider.container);
slider.cloneCount=0;
slider.cloneOffset=0;
if(reverse){
arr=$.makeArray(slider.slides).reverse();
slider.slides=$(arr);
slider.container.empty().append(slider.slides);
}}
if(slider.vars.animationLoop&&!carousel){
slider.cloneCount=2;
slider.cloneOffset=1;
if(type!=="init") slider.container.find('.clone').remove();
methods.uniqueID(slider.slides.first().clone().addClass('clone').attr('aria-hidden', 'true')).appendTo(slider.container);
methods.uniqueID(slider.slides.last().clone().addClass('clone').attr('aria-hidden', 'true')).prependTo(slider.container);
}
slider.newSlides=$(slider.vars.selector, slider);
sliderOffset=(reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset:slider.currentSlide + slider.cloneOffset;
if(vertical&&!carousel){
slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%");
setTimeout(function(){
slider.newSlides.css({"display": "block"});
slider.doMath();
slider.viewport.height(slider.h);
slider.setProps(sliderOffset * slider.h, "init");
}, (type==="init") ? 100:0);
}else{
slider.container.width((slider.count + slider.cloneCount) * 200 + "%");
slider.setProps(sliderOffset * slider.computedW, "init");
setTimeout(function(){
slider.doMath();
slider.newSlides.css({"width": slider.computedW, "float": "left", "display": "block"});
if(slider.vars.smoothHeight) methods.smoothHeight();
}, (type==="init") ? 100:0);
}}else{
slider.slides.css({"width": "100%", "float": "left", "marginRight": "-100%", "position": "relative"});
if(type==="init"){
if(!touch){
slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).animate({"opacity": 1},slider.vars.animationSpeed,slider.vars.easing);
}else{
slider.slides.css({ "opacity": 0, "display": "block", "webkitTransition": "opacity " + slider.vars.animationSpeed / 1000 + "s ease", "zIndex": 1 }).eq(slider.currentSlide).css({ "opacity": 1, "zIndex": 2});
}}
if(slider.vars.smoothHeight) methods.smoothHeight();
}
if(!carousel) slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide");
slider.vars.init(slider);
};
slider.doMath=function(){
var slide=slider.slides.first(),
slideMargin=slider.vars.itemMargin,
minItems=slider.vars.minItems,
maxItems=slider.vars.maxItems;
slider.w=(slider.viewport===undefined) ? slider.width():slider.viewport.width();
slider.h=slide.height();
slider.boxPadding=slide.outerWidth() - slide.width();
if(carousel){
slider.itemT=slider.vars.itemWidth + slideMargin;
slider.minW=(minItems) ? minItems * slider.itemT:slider.w;
slider.maxW=(maxItems) ? (maxItems * slider.itemT) - slideMargin:slider.w;
slider.itemW=(slider.minW > slider.w) ? (slider.w - (slideMargin * (minItems - 1)))/minItems :
(slider.maxW < slider.w) ? (slider.w - (slideMargin * (maxItems - 1)))/maxItems :
(slider.vars.itemWidth > slider.w) ? slider.w:slider.vars.itemWidth;
slider.visible=Math.floor(slider.w/(slider.itemW + slideMargin));
slider.move=(slider.vars.move > 0&&slider.vars.move < slider.visible) ? slider.vars.move:slider.visible;
slider.pagingCount=Math.ceil(((slider.count - slider.visible)/slider.move) + 1);
slider.last=slider.pagingCount - 1;
slider.limit=(slider.pagingCount===1) ? 0 :
(slider.vars.itemWidth > slider.w) ? (slider.itemW * (slider.count - 1)) + (slideMargin * (slider.count - 1)):((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin;
}else{
slider.itemW=slider.w;
slider.pagingCount=slider.count;
slider.last=slider.count - 1;
}
slider.computedW=slider.itemW - slider.boxPadding;
};
slider.update=function(pos, action){
slider.doMath();
if(!carousel){
if(pos < slider.currentSlide){
slider.currentSlide +=1;
}else if(pos <=slider.currentSlide&&pos!==0){
slider.currentSlide -=1;
}
slider.animatingTo=slider.currentSlide;
}
if(slider.vars.controlNav&&!slider.manualControls){
if((action==="add"&&!carousel)||slider.pagingCount > slider.controlNav.length){
methods.controlNav.update("add");
}else if((action==="remove"&&!carousel)||slider.pagingCount < slider.controlNav.length){
if(carousel&&slider.currentSlide > slider.last){
slider.currentSlide -=1;
slider.animatingTo -=1;
}
methods.controlNav.update("remove", slider.last);
}}
if(slider.vars.directionNav) methods.directionNav.update();
};
slider.addSlide=function(obj, pos){
var $obj=$(obj);
slider.count +=1;
slider.last=slider.count - 1;
if(vertical&&reverse){
(pos!==undefined) ? slider.slides.eq(slider.count - pos).after($obj):slider.container.prepend($obj);
}else{
(pos!==undefined) ? slider.slides.eq(pos).before($obj):slider.container.append($obj);
}
slider.update(pos, "add");
slider.slides=$(slider.vars.selector + ':not(.clone)', slider);
slider.setup();
slider.vars.added(slider);
};
slider.removeSlide=function(obj){
var pos=(isNaN(obj)) ? slider.slides.index($(obj)):obj;
slider.count -=1;
slider.last=slider.count - 1;
if(isNaN(obj)){
$(obj, slider.slides).remove();
}else{
(vertical&&reverse) ? slider.slides.eq(slider.last).remove():slider.slides.eq(obj).remove();
}
slider.doMath();
slider.update(pos, "remove");
slider.slides=$(slider.vars.selector + ':not(.clone)', slider);
slider.setup();
slider.vars.removed(slider);
};
slider.destroy=function(){
var classNamespace='.' + slider.vars.namespace;
if(slider.vars.controlNav) slider.controlNav.closest(classNamespace + 'control-nav').remove();
if(slider.vars.directionNav) slider.directionNav.closest(classNamespace + 'direction-nav').remove();
if(slider.vars.pausePlay) slider.pausePlay.closest(classNamespace + 'pauseplay').remove();
slider.find('.clone').remove();
slider.unbind(slider.vars.eventNamespace);
if(slider.vars.animation!="fade") slider.container.unwrap();
slider.container.removeAttr('style');
slider.container.unbind(slider.vars.eventNamespace);
slider.slides.removeAttr('style');
slider.slides.filter(classNamespace + 'active-slide').removeClass(slider.vars.namespace + 'active-slide');
slider.slides.unbind(slider.vars.eventNamespace);
$(document).unbind(slider.vars.eventNamespace + "-" + slider.id);
$(window).unbind(slider.vars.eventNamespace + "-" + slider.id);
slider.stop();
slider.removeData('flexslider');
};
methods.init();
};
$(window).blur(function(e){
focused=false;
}).focus(function(e){
focused=true;
});
$.flexslider.defaults={
namespace: "flex-",
selector: ".slides > li",
animation: "fade",
easing: "swing",
direction: "horizontal",
reverse: false,
animationLoop: true,
smoothHeight: false,
startAt: 0,
slideshow: true,
slideshowSpeed: 7000,
animationSpeed: 600,
initDelay: 0,
randomize: false,
thumbCaptions: false,
pauseOnAction: true,
pauseOnHover: false,
pauseInvisible: true,
useCSS: true,
touch: true,
video: false,
controlNav: true,
directionNav: true,
prevText: "",
nextText: "",
keyboard: true,
multipleKeyboard: false,
mousewheel: false,
pausePlay: false,
pauseText: "Pause",
playText: "Play",
controlsContainer: "",
manualControls: "",
sync: "",
asNavFor: "",
itemWidth: 0,
itemMargin: 0,
minItems: 1,
maxItems: 0,
move: 0,
allowOneSlide: true,
start: function(){},
before: function(){},
after: function(){},
end: function(){},
added: function(){},
removed: function(){},
init: function(){}};
$.fn.flexslider=function(options){
if(options===undefined) options={};
if(typeof options==="object"){
return this.each(function(){
var $this=$(this),
selector=(options.selector) ? options.selector:".slides > li",
$slides=$this.find(selector);
if(( $slides.length===1&&options.allowOneSlide===true)||$slides.length===0){
$slides.fadeIn(400);
if(options.start) options.start($this);
}else if($this.data('flexslider')===undefined){
new $.flexslider(this, options);
}});
}else{
var $slider=$(this).data('flexslider');
switch (options){
case "play": $slider.play(); break;
case "pause": $slider.pause(); break;
case "stop": $slider.stop(); break;
case "next": $slider.flexAnimate($slider.getTarget("next"), true); break;
case "prev":
case "previous": $slider.flexAnimate($slider.getTarget("prev"), true); break;
case "destroy": $slider.destroy(); break;
default: if(typeof options==="number") $slider.flexAnimate(options, true);
}}
};})(jQuery);
;(function($, window, document, undefined){
"use strict";
var $plugin_name="fusion_maps",
$defaults={
addresses: {},
address_pin: true,
animations: true,
delay: 10,
infobox_background_color: false,
infobox_styling: 'default',
infobox_text_color: false,
map_style: 'default',
map_type: 'roadmap',
marker_icon: false,
overlay_color: false,
overlay_color_hsl: {},
pan_control: true,
show_address: true,
scale_control: true,
scrollwheel: true,
zoom: 9,
zoom_control: true
};
function Plugin($element, $options){
this.element=$element;
this.settings=$.extend({}, $defaults, $options);
this._defaults=$defaults;
this._name=$plugin_name;
this.geocoder=new google.maps.Geocoder();
this.next_address=0;
this.infowindow=new google.maps.InfoWindow();
this.markers=[];
this.query_sent=false;
this.last_cache_index='none';
this.bounds=new google.maps.LatLngBounds();
this.init();
}
$.extend(Plugin.prototype, {
init: function(){
var $map_options={
zoom: this.settings.zoom,
mapTypeId: this.settings.map_type,
scrollwheel: this.settings.scrollwheel,
scaleControl: this.settings.scale_control,
panControl: this.settings.pan_control,
zoomControl: this.settings.zoom_control
},
$latlng, $styles,
$isDraggable=$(document).width() > 640 ? true:false,
$plugin_object=this;
if(! this.settings.scrollwheel){
$map_options.draggable=$isDraggable;
}
if(! this.settings.address_pin){
this.settings.addresses=[ this.settings.addresses[0] ];
}
jQuery.each(this.settings.addresses, function($index){
if(this.cache==false){
$plugin_object.last_cache_index=$index;
}});
if(this.settings.addresses[0].coordinates){
$latlng=new google.maps.LatLng(this.settings.addresses[0].latitude, this.settings.addresses[0].longitude);
$map_options.center=$latlng;
}
this.map=new google.maps.Map(this.element, $map_options);
if(this.settings.overlay_color&&this.settings.map_style=='custom'){
$styles=[
{
stylers: [
{ hue: this.settings.overlay_color },
{ lightness: this.settings.overlay_color_hsl.lum * 2 - 100 },
{ saturation: this.settings.overlay_color_hsl.sat * 2 - 100 }
]
},
{
featureType: 'road',
elementType: 'geometry',
stylers: [
{ visibility: 'simplified' }
]
},
{
featureType: 'road',
elementType: 'labels'
}
];
this.map.setOptions({
styles: $styles
});
}
var bounds_changed=google.maps.event.addListener(this.map, 'bounds_changed', function(){
var $latlng=new google.maps.LatLng($plugin_object.settings.addresses[0].latitude, $plugin_object.settings.addresses[0].longitude);
$plugin_object.map.setZoom($plugin_object.settings.zoom);
$plugin_object.map.setCenter($latlng);
google.maps.event.removeListener(bounds_changed);
});
this.next_geocode_request();
},
geocode_address: function($search, $index){
var $plugin_object=this,
$lat_lng_object,
$address_object,
$latitude,
$longitude,
$location,
$cache=true,
$query_sent;
if(typeof($search)=='object'&&$search.cache==false){
$cache=false;
if($search.coordinates===true){
$lat_lng_object=new google.maps.LatLng($search.latitude, $search.longitude);
$address_object={ latLng: $lat_lng_object };}else{
$address_object={ address: $search.address };}
this.geocoder.geocode($address_object, function($results, $status){
var $latitude, $longitude, $location;
if($status==google.maps.GeocoderStatus.OK){
if($search.coordinates===true){
$location=$lat_lng_object;
$latitude=jQuery.trim($search.latitude);
$longitude=jQuery.trim($search.longitude);
}else{
$location=$results[0].geometry.location;
$latitude=$location.lat();
$longitude=$location.lng();
}
$plugin_object.settings.addresses[ $index ]['latitude']=$latitude;
$plugin_object.settings.addresses[ $index ]['longitude']=$longitude;
if($search.coordinates===true&&$search.infobox_content===''){
$search.geocoded_address=$results[0].formatted_address;
}
if($plugin_object.next_address==1&&! $search.coordinates){
$plugin_object.map.setCenter($location);
}
if($plugin_object.settings.address_pin){
$plugin_object.create_marker($search, $latitude, $longitude);
}
if($plugin_object.next_address==0){
$plugin_object.map.setCenter($location);
}}else{
if($status==google.maps.GeocoderStatus.OVER_QUERY_LIMIT){
$plugin_object.next_address--;
$plugin_object.settings.delay++;
}}
if($cache==false&&$plugin_object.query_sent==false&&$plugin_object.last_cache_index==$index){
var $data={
action: 'fusion_cache_map',
addresses: $plugin_object.settings.addresses,
security: js_local_vars.admin_ajax_nonce
};
jQuery.post(js_local_vars.admin_ajax, $data);
$plugin_object.query_sent=true;
}
$plugin_object.next_geocode_request();
});
}else if(typeof($search)=='object'&&$search.cache==true){
$latitude=jQuery.trim($search.latitude);
$longitude=jQuery.trim($search.longitude);
$location=new google.maps.LatLng($latitude, $longitude);
if($search.coordinates===true&&$search.infobox_content===''){
$search.geocoded_address=$search.geocoded_address;
}
if($plugin_object.settings.address_pin){
$plugin_object.create_marker($search, $latitude, $longitude);
}
if($plugin_object.next_address==0){
$plugin_object.map.setCenter($location);
}
$plugin_object.next_geocode_request();
}},
create_marker: function($address, $latitude, $longitude, $location){
var $content_string,
$marker_settings={
position: new google.maps.LatLng($latitude, $longitude),
map: this.map
},
$marker;
this.bounds.extend($marker_settings.position);
if($address.infobox_content){
$content_string=$address.infobox_content;
}else{
$content_string=$address.address;
if($address.coordinates===true&&$address.geocoded_address){
$content_string=$address.geocoded_address;
}}
if(this.settings.animations){
$marker_settings.animation=google.maps.Animation.DROP;
}
if(this.settings.map_style=='custom'&&this.settings.marker_icon=='theme'){
$marker_settings.icon=new google.maps.MarkerImage($address.marker, null, null, null, new google.maps.Size(37, 55));
}else if(this.settings.map_style=='custom'&&$address.marker){
$marker_settings.icon=$address.marker;
}
$marker=new google.maps.Marker($marker_settings);
this.markers.push($marker);
this.create_infowindow($content_string, $marker);
if(this.next_address >=this.settings.addresses.length){
this.map.fitBounds(this.bounds);
}},
create_infowindow: function($content_string, $marker){
var $info_window, $info_box_div, $info_box_options,
$plugin_object=this;
if(this.settings.infobox_styling=='custom'&&this.settings.map_style=='custom'){
$info_box_div=document.createElement('div');
$info_box_options={
content: $info_box_div,
disableAutoPan: true,
maxWidth: 150,
pixelOffset: new google.maps.Size(-125, 10),
zIndex: null,
boxStyle: {
background: 'none',
opacity: 1,
width: '250px'
},
closeBoxMargin: '2px 2px 2px 2px',
closeBoxURL: '//www.google.com/intl/en_us/mapfiles/close.gif',
infoBoxClearance: new google.maps.Size(1, 1)
};
$info_box_div.className='fusion-info-box';
$info_box_div.style.cssText='background-color:' + this.settings.infobox_background_color + ';color:' + this.settings.infobox_text_color + ';';
$info_box_div.innerHTML=$content_string;
$info_window=new InfoBox($info_box_options);
$info_window.open(this.map, $marker);
if(! this.settings.show_address){
$info_window.close(this.map, $marker);
}
google.maps.event.addListener($marker, 'click', function(){
var $map=$info_window.getMap();
if($map===null||typeof $map==='undefined'){
$info_window.open($plugin_object.map, this);
}else{
$info_window.close($plugin_object.map, this);
}});
}else{
$info_window=new google.maps.InfoWindow({
disableAutoPan: true,
content: $content_string
});
if(this.settings.show_address){
$info_window.show=true;
$info_window.open(this.map, $marker);
}
google.maps.event.addListener($marker, 'click', function(){
var $map=$info_window.getMap();
if($map===null||typeof $map==='undefined'){
$info_window.open($plugin_object.map, this);
}else{
$info_window.close($plugin_object.map, this);
}});
}},
next_geocode_request: function(){
var $plugin_object=this;
if($plugin_object.next_address < $plugin_object.settings.addresses.length){
setTimeout(function(){
$plugin_object.geocode_address($plugin_object.settings.addresses[$plugin_object.next_address], $plugin_object.next_address);
$plugin_object.next_address++;
}, $plugin_object.settings.delay);
}}
});
$.fn[ $plugin_name ]=function($options){
this.each(function(){
if(! $.data(this, 'plugin_' + $plugin_name)){
$.data(this, 'plugin_' + $plugin_name, new Plugin(this, $options));
}});
return this;
};})(jQuery, window, document);
(function($){
$.fn.hoverFlow=function(type, prop, speed, easing, callback){
if($.inArray(type, ['mouseover', 'mouseenter', 'mouseout', 'mouseleave'])==-1){
return this;
}
var opt=typeof speed==='object' ? speed:{
complete: callback||!callback&&easing||$.isFunction(speed)&&speed,
duration: speed,
easing: callback&&easing||easing&&!$.isFunction(easing)&&easing
};
opt.queue=false;
var origCallback=opt.complete;
opt.complete=function(){
$(this).dequeue();
if($.isFunction(origCallback)){
origCallback.call(this);
}};
return this.each(function(){
var $this=$(this);
if(type=='mouseover'||type=='mouseenter'){
$this.data('jQuery.hoverFlow', true);
}else{
$this.removeData('jQuery.hoverFlow');
}
$this.queue(function(){
var condition=(type=='mouseover'||type=='mouseenter') ?
$this.data('jQuery.hoverFlow')!==undefined :
$this.data('jQuery.hoverFlow')===undefined;
if(condition){
$this.animate(prop, opt);
}else{
$this.queue([]);
}});
});
};})(jQuery);
(function($){
$.fn.hoverIntent=function(handlerIn,handlerOut,selector){
var cfg={
interval: 100,
sensitivity: 7,
timeout: 0
};
if(typeof handlerIn==="object"){
cfg=$.extend(cfg, handlerIn);
}else if($.isFunction(handlerOut)){
cfg=$.extend(cfg, { over: handlerIn, out: handlerOut, selector: selector });
}else{
cfg=$.extend(cfg, { over: handlerIn, out: handlerIn, selector: handlerOut });
}
var cX, cY, pX, pY;
var track=function(ev){
cX=ev.pageX;
cY=ev.pageY;
};
var compare=function(ev,ob){
ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);
if(( Math.abs(pX-cX) + Math.abs(pY-cY)) < cfg.sensitivity){
$(ob).off("mousemove.hoverIntent",track);
ob.hoverIntent_s=1;
return cfg.over.apply(ob,[ev]);
}else{
pX=cX; pY=cY;
ob.hoverIntent_t=setTimeout(function(){compare(ev, ob);} , cfg.interval);
}};
var delay=function(ev,ob){
ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);
ob.hoverIntent_s=0;
return cfg.out.apply(ob,[ev]);
};
var handleHover=function(e){
var ev=jQuery.extend({},e);
var ob=this;
if(ob.hoverIntent_t){ ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t); }
if(e.type=="mouseenter"){
pX=ev.pageX; pY=ev.pageY;
$(ob).on("mousemove.hoverIntent",track);
if(ob.hoverIntent_s!=1){ ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);} , cfg.interval);}}else{
$(ob).off("mousemove.hoverIntent",track);
if(ob.hoverIntent_s==1){ ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);} , cfg.timeout);}}
};
return this.on({'mouseenter.hoverIntent':handleHover,'mouseleave.hoverIntent':handleHover}, cfg.selector);
};})(jQuery);
;(function(window, document, $){
var isInputSupported='placeholder' in document.createElement('input');
var isTextareaSupported='placeholder' in document.createElement('textarea');
var prototype=$.fn;
var valHooks=$.valHooks;
var propHooks=$.propHooks;
var hooks;
var placeholder;
if(isInputSupported&&isTextareaSupported){
placeholder=prototype.placeholder=function(){
return this;
};
placeholder.input=placeholder.textarea=true;
}else{
placeholder=prototype.placeholder=function(){
var $this=this;
$this
.filter((isInputSupported ? 'textarea':':input') + '[placeholder]')
.not('.placeholder')
.bind({
'focus.placeholder': clearPlaceholder,
'blur.placeholder': setPlaceholder
})
.data('placeholder-enabled', true)
.trigger('blur.placeholder');
return $this;
};
placeholder.input=isInputSupported;
placeholder.textarea=isTextareaSupported;
hooks={
'get': function(element){
var $element=$(element);
var $passwordInput=$element.data('placeholder-password');
if($passwordInput){
return $passwordInput[0].value;
}
return $element.data('placeholder-enabled')&&$element.hasClass('placeholder') ? '':element.value;
},
'set': function(element, value){
var $element=$(element);
var $passwordInput=$element.data('placeholder-password');
if($passwordInput){
return $passwordInput[0].value=value;
}
if(!$element.data('placeholder-enabled')){
return element.value=value;
}
if(value==''){
element.value=value;
if(element!=safeActiveElement()){
setPlaceholder.call(element);
}}else if($element.hasClass('placeholder')){
clearPlaceholder.call(element, true, value)||(element.value=value);
}else{
element.value=value;
}
return $element;
}};
if(!isInputSupported){
valHooks.input=hooks;
propHooks.value=hooks;
}
if(!isTextareaSupported){
valHooks.textarea=hooks;
propHooks.value=hooks;
}
$(function(){
$(document).delegate('form', 'submit.placeholder', function(){
var $inputs=$('.placeholder', this).each(clearPlaceholder);
setTimeout(function(){
$inputs.each(setPlaceholder);
}, 10);
});
});
$(window).bind('beforeunload.placeholder', function(){
$('.placeholder').each(function(){
this.value='';
});
});
}
function args(elem){
var newAttrs={};
var rinlinejQuery=/^jQuery\d+$/;
$.each(elem.attributes, function(i, attr){
if(attr.specified&&!rinlinejQuery.test(attr.name)){
newAttrs[attr.name]=attr.value;
}});
return newAttrs;
}
function clearPlaceholder(event, value){
var input=this;
var $input=$(input);
if(input.value==$input.attr('placeholder')&&$input.hasClass('placeholder')){
if($input.data('placeholder-password')){
$input=$input.hide().next().show().attr('id', $input.removeAttr('id').data('placeholder-id'));
if(event===true){
return $input[0].value=value;
}
$input.focus();
}else{
input.value='';
$input.removeClass('placeholder');
input==safeActiveElement()&&input.select();
}}
}
function setPlaceholder(){
var $replacement;
var input=this;
var $input=$(input);
var id=this.id;
if(input.value==''){
if(input.type=='password'){
if(!$input.data('placeholder-textinput')){
try {
$replacement=$input.clone().attr({ 'type': 'text' });
} catch(e){
$replacement=$('').attr($.extend(args(this), { 'type': 'text' }));
}
$replacement
.removeAttr('name')
.data({
'placeholder-password': $input,
'placeholder-id': id
})
.bind('focus.placeholder', clearPlaceholder);
$input
.data({
'placeholder-textinput': $replacement,
'placeholder-id': id
})
.before($replacement);
}
$input=$input.removeAttr('id').hide().prev().attr('id', id).show();
}
$input.addClass('placeholder');
$input[0].value=$input.attr('placeholder');
}else{
$input.removeClass('placeholder');
}}
function safeActiveElement(){
try {
return document.activeElement;
} catch (err){}}
}(this, document, jQuery));
(function($){
$.fn.UItoTop=function(options){
var defaults={
text: '',
min: 200,
inDelay:600,
outDelay:400,
containerID: 'toTop',
containerHoverID: 'toTopHover',
scrollSpeed: 1200,
easingType: 'linear'
},
settings=$.extend(defaults, options),
containerIDhash='#' + settings.containerID,
containerHoverIDHash='#'+settings.containerHoverID;
$('body').append('');
$(containerIDhash).hide().on('click.UItoTop',function(){
$('html, body').animate({scrollTop:0}, settings.scrollSpeed, settings.easingType);
$('#'+settings.containerHoverID, this).stop().animate({'opacity': 0 }, settings.inDelay, settings.easingType);
return false;
})
.prepend('')
.hover(function(){
$(containerHoverIDHash, this).stop().animate({
'opacity': 1
}, 600, 'linear');
}, function(){
$(containerHoverIDHash, this).stop().animate({
'opacity': 0
}, 700, 'linear');
});
$(window).scroll(function(){
var sd=$(window).scrollTop();
if(typeof document.body.style.maxHeight==="undefined"){
$(containerIDhash).css({
'position': 'absolute',
'top': sd + $(window).height() - 50
});
}
if(sd > settings.min){
$(containerIDhash).fadeIn(settings.inDelay);
}else{
$(containerIDhash).fadeOut(settings.Outdelay);
}});
};})(jQuery);
(function(){
var __indexOf=[].indexOf||function(item){ for (var i=0, l=this.length; i < l; i++){ if(i in this&&this[i]===item) return i; } return -1; },
__slice=[].slice;
(function(root, factory){
if(typeof define==='function'&&define.amd){
return define('waypoints', ['jquery'], function($){
return factory($, root);
});
}else{
return factory(root.jQuery, root);
}})(this, function($, window){
var $w, Context, Waypoint, allWaypoints, contextCounter, contextKey, contexts, isTouch, jQMethods, methods, resizeEvent, scrollEvent, waypointCounter, waypointKey, wp, wps;
$w=$(window);
isTouch=__indexOf.call(window, 'ontouchstart') >=0;
allWaypoints={
horizontal: {},
vertical: {}};
contextCounter=1;
contexts={};
contextKey='waypoints-context-id';
resizeEvent='resize.waypoints';
scrollEvent='scroll.waypoints';
waypointCounter=1;
waypointKey='waypoints-waypoint-ids';
wp='waypoint';
wps='waypoints';
Context=(function(){
function Context($element){
var _this=this;
this.$element=$element;
this.element=$element[0];
this.didResize=false;
this.didScroll=false;
this.id='context' + contextCounter++;
this.oldScroll={
x: $element.scrollLeft(),
y: $element.scrollTop()
};
this.waypoints={
horizontal: {},
vertical: {}};
$element.data(contextKey, this.id);
contexts[this.id]=this;
$element.bind(scrollEvent, function(){
var scrollHandler;
if(!(_this.didScroll||isTouch)){
_this.didScroll=true;
scrollHandler=function(){
_this.doScroll();
return _this.didScroll=false;
};
return window.setTimeout(scrollHandler, $[wps].settings.scrollThrottle);
}});
$element.bind(resizeEvent, function(){
var resizeHandler;
if(!_this.didResize){
_this.didResize=true;
resizeHandler=function(){
$[wps]('refresh');
return _this.didResize=false;
};
return window.setTimeout(resizeHandler, $[wps].settings.resizeThrottle);
}});
}
Context.prototype.doScroll=function(){
var axes,
_this=this;
axes={
horizontal: {
newScroll: this.$element.scrollLeft(),
oldScroll: this.oldScroll.x,
forward: 'right',
backward: 'left'
},
vertical: {
newScroll: this.$element.scrollTop(),
oldScroll: this.oldScroll.y,
forward: 'down',
backward: 'up'
}};
if(isTouch&&(!axes.vertical.oldScroll||!axes.vertical.newScroll)){
$[wps]('refresh');
}
$.each(axes, function(aKey, axis){
var direction, isForward, triggered;
triggered=[];
isForward=axis.newScroll > axis.oldScroll;
direction=isForward ? axis.forward:axis.backward;
$.each(_this.waypoints[aKey], function(wKey, waypoint){
var _ref, _ref1;
if((axis.oldScroll < (_ref=waypoint.offset)&&_ref <=axis.newScroll)){
return triggered.push(waypoint);
}else if((axis.newScroll < (_ref1=waypoint.offset)&&_ref1 <=axis.oldScroll)){
return triggered.push(waypoint);
}});
triggered.sort(function(a, b){
return a.offset - b.offset;
});
if(!isForward){
triggered.reverse();
}
return $.each(triggered, function(i, waypoint){
if(waypoint.options.continuous||i===triggered.length - 1){
return waypoint.trigger([direction]);
}});
});
return this.oldScroll={
x: axes.horizontal.newScroll,
y: axes.vertical.newScroll
};};
Context.prototype.refresh=function(){
var axes, cOffset, isWin,
_this=this;
isWin=$.isWindow(this.element);
cOffset=this.$element.offset();
this.doScroll();
axes={
horizontal: {
contextOffset: isWin ? 0:cOffset.left,
contextScroll: isWin ? 0:this.oldScroll.x,
contextDimension: this.$element.width(),
oldScroll: this.oldScroll.x,
forward: 'right',
backward: 'left',
offsetProp: 'left'
},
vertical: {
contextOffset: isWin ? 0:cOffset.top,
contextScroll: isWin ? 0:this.oldScroll.y,
contextDimension: isWin ? $[wps]('viewportHeight'):this.$element.height(),
oldScroll: this.oldScroll.y,
forward: 'down',
backward: 'up',
offsetProp: 'top'
}};
return $.each(axes, function(aKey, axis){
return $.each(_this.waypoints[aKey], function(i, waypoint){
var adjustment, elementOffset, oldOffset, _ref, _ref1;
adjustment=waypoint.options.offset;
oldOffset=waypoint.offset;
elementOffset=$.isWindow(waypoint.element) ? 0:waypoint.$element.offset()[axis.offsetProp];
if($.isFunction(adjustment)){
adjustment=adjustment.apply(waypoint.element);
}else if(typeof adjustment==='string'){
adjustment=parseFloat(adjustment);
if(waypoint.options.offset.indexOf('%') > -1){
adjustment=Math.ceil(axis.contextDimension * adjustment / 100);
}}
waypoint.offset=elementOffset - axis.contextOffset + axis.contextScroll - adjustment;
if((waypoint.options.onlyOnScroll&&(oldOffset!=null))||!waypoint.enabled){
return;
}
if(oldOffset!==null&&(oldOffset < (_ref=axis.oldScroll)&&_ref <=waypoint.offset)){
return waypoint.trigger([axis.backward]);
}else if(oldOffset!==null&&(oldOffset > (_ref1=axis.oldScroll)&&_ref1 >=waypoint.offset)){
return waypoint.trigger([axis.forward]);
}else if(oldOffset===null&&axis.oldScroll >=waypoint.offset){
return waypoint.trigger([axis.forward]);
}});
});
};
Context.prototype.checkEmpty=function(){
if($.isEmptyObject(this.waypoints.horizontal)&&$.isEmptyObject(this.waypoints.vertical)){
this.$element.unbind([resizeEvent, scrollEvent].join(' '));
return delete contexts[this.id];
}};
return Context;
})();
Waypoint=(function(){
function Waypoint($element, context, options){
var idList, _ref;
options=$.extend({}, $.fn[wp].defaults, options);
if(options.offset==='bottom-in-view'){
options.offset=function(){
var contextHeight;
contextHeight=$[wps]('viewportHeight');
if(!$.isWindow(context.element)){
contextHeight=context.$element.height();
}
return contextHeight - $(this).outerHeight();
};}
this.$element=$element;
this.element=$element[0];
this.axis=options.horizontal ? 'horizontal':'vertical';
this.callback=options.handler;
this.context=context;
this.enabled=options.enabled;
this.id='waypoints' + waypointCounter++;
this.offset=null;
this.options=options;
context.waypoints[this.axis][this.id]=this;
allWaypoints[this.axis][this.id]=this;
idList=(_ref=$element.data(waypointKey))!=null ? _ref:[];
idList.push(this.id);
$element.data(waypointKey, idList);
}
Waypoint.prototype.trigger=function(args){
if(!this.enabled){
return;
}
if(this.callback!=null){
this.callback.apply(this.element, args);
}
if(this.options.triggerOnce){
return this.destroy();
}};
Waypoint.prototype.disable=function(){
return this.enabled=false;
};
Waypoint.prototype.enable=function(){
this.context.refresh();
return this.enabled=true;
};
Waypoint.prototype.destroy=function(){
delete allWaypoints[this.axis][this.id];
delete this.context.waypoints[this.axis][this.id];
return this.context.checkEmpty();
};
Waypoint.getWaypointsByElement=function(element){
var all, ids;
ids=$(element).data(waypointKey);
if(!ids){
return [];
}
all=$.extend({}, allWaypoints.horizontal, allWaypoints.vertical);
return $.map(ids, function(id){
return all[id];
});
};
return Waypoint;
})();
methods={
init: function(f, options){
var _ref;
if(options==null){
options={};}
if((_ref=options.handler)==null){
options.handler=f;
}
this.each(function(){
var $this, context, contextElement, _ref1;
$this=$(this);
contextElement=(_ref1=options.context)!=null ? _ref1:$.fn[wp].defaults.context;
if(!$.isWindow(contextElement)){
contextElement=$this.closest(contextElement);
}
contextElement=$(contextElement);
context=contexts[contextElement.data(contextKey)];
if(!context){
context=new Context(contextElement);
}
return new Waypoint($this, context, options);
});
$[wps]('refresh');
return this;
},
disable: function(){
return methods._invoke(this, 'disable');
},
enable: function(){
return methods._invoke(this, 'enable');
},
destroy: function(){
return methods._invoke(this, 'destroy');
},
prev: function(axis, selector){
return methods._traverse.call(this, axis, selector, function(stack, index, waypoints){
if(index > 0){
return stack.push(waypoints[index - 1]);
}});
},
next: function(axis, selector){
return methods._traverse.call(this, axis, selector, function(stack, index, waypoints){
if(index < waypoints.length - 1){
return stack.push(waypoints[index + 1]);
}});
},
_traverse: function(axis, selector, push){
var stack, waypoints;
if(axis==null){
axis='vertical';
}
if(selector==null){
selector=window;
}
waypoints=jQMethods.aggregate(selector);
stack=[];
this.each(function(){
var index;
index=$.inArray(this, waypoints[axis]);
return push(stack, index, waypoints[axis]);
});
return this.pushStack(stack);
},
_invoke: function($elements, method){
$elements.each(function(){
var waypoints;
waypoints=Waypoint.getWaypointsByElement(this);
return $.each(waypoints, function(i, waypoint){
waypoint[method]();
return true;
});
});
return this;
}};
$.fn[wp]=function(){
var args, method;
method=arguments[0], args=2 <=arguments.length ? __slice.call(arguments, 1):[];
if(methods[method]){
return methods[method].apply(this, args);
}else if($.isFunction(method)){
return methods.init.apply(this, arguments);
}else if($.isPlainObject(method)){
return methods.init.apply(this, [null, method]);
}else if(!method){
return $.error("jQuery Waypoints needs a callback function or handler option.");
}else{
return $.error("The " + method + " method does not exist in jQuery Waypoints.");
}};
$.fn[wp].defaults={
context: window,
continuous: true,
enabled: true,
horizontal: false,
offset: 0,
triggerOnce: false
};
jQMethods={
refresh: function(){
return $.each(contexts, function(i, context){
return context.refresh();
});
},
viewportHeight: function(){
var _ref;
return (_ref=window.innerHeight)!=null ? _ref:$w.height();
},
aggregate: function(contextSelector){
var collection, waypoints, _ref;
collection=allWaypoints;
if(contextSelector){
collection=(_ref=contexts[$(contextSelector).data(contextKey)])!=null ? _ref.waypoints:void 0;
}
if(!collection){
return [];
}
waypoints={
horizontal: [],
vertical: []
};
$.each(waypoints, function(axis, arr){
$.each(collection[axis], function(key, waypoint){
return arr.push(waypoint);
});
arr.sort(function(a, b){
return a.offset - b.offset;
});
waypoints[axis]=$.map(arr, function(waypoint){
return waypoint.element;
});
return waypoints[axis]=$.unique(waypoints[axis]);
});
return waypoints;
},
above: function(contextSelector){
if(contextSelector==null){
contextSelector=window;
}
return jQMethods._filter(contextSelector, 'vertical', function(context, waypoint){
return waypoint.offset <=context.oldScroll.y;
});
},
below: function(contextSelector){
if(contextSelector==null){
contextSelector=window;
}
return jQMethods._filter(contextSelector, 'vertical', function(context, waypoint){
return waypoint.offset > context.oldScroll.y;
});
},
left: function(contextSelector){
if(contextSelector==null){
contextSelector=window;
}
return jQMethods._filter(contextSelector, 'horizontal', function(context, waypoint){
return waypoint.offset <=context.oldScroll.x;
});
},
right: function(contextSelector){
if(contextSelector==null){
contextSelector=window;
}
return jQMethods._filter(contextSelector, 'horizontal', function(context, waypoint){
return waypoint.offset > context.oldScroll.x;
});
},
enable: function(){
return jQMethods._invoke('enable');
},
disable: function(){
return jQMethods._invoke('disable');
},
destroy: function(){
return jQMethods._invoke('destroy');
},
extendFn: function(methodName, f){
return methods[methodName]=f;
},
_invoke: function(method){
var waypoints;
waypoints=$.extend({}, allWaypoints.vertical, allWaypoints.horizontal);
return $.each(waypoints, function(key, waypoint){
waypoint[method]();
return true;
});
},
_filter: function(selector, axis, test){
var context, waypoints;
context=contexts[$(selector).data(contextKey)];
if(!context){
return [];
}
waypoints=[];
$.each(context.waypoints[axis], function(i, waypoint){
if(test(context, waypoint)){
return waypoints.push(waypoint);
}});
waypoints.sort(function(a, b){
return a.offset - b.offset;
});
return $.map(waypoints, function(waypoint){
return waypoint.element;
});
}};
$[wps]=function(){
var args, method;
method=arguments[0], args=2 <=arguments.length ? __slice.call(arguments, 1):[];
if(jQMethods[method]){
return jQMethods[method].apply(null, args);
}else{
return jQMethods.aggregate.call(null, method);
}};
$[wps].settings={
resizeThrottle: 100,
scrollThrottle: 30
};
return $w.load(function(){
return $[wps]('refresh');
});
});
}).call(this);
;
window.Modernizr=(function(window, document, undefined){
var version='2.6.2',
Modernizr={},
enableClasses=true,
docElement=document.documentElement,
mod='modernizr',
modElem=document.createElement(mod),
mStyle=modElem.style,
inputElem=document.createElement('input') ,
smile=':)',
toString={}.toString,
prefixes=' -webkit- -moz- -o- -ms- '.split(' '),
omPrefixes='Webkit Moz O ms',
cssomPrefixes=omPrefixes.split(' '),
domPrefixes=omPrefixes.toLowerCase().split(' '),
ns={'svg': 'http://www.w3.org/2000/svg'},
tests={},
inputs={},
attrs={},
classes=[],
slice=classes.slice,
featureName,
injectElementWithStyles=function(rule, callback, nodes, testnames){
var style, ret, node, docOverflow,
div=document.createElement('div'),
body=document.body,
fakeBody=body||document.createElement('body');
if(parseInt(nodes, 10)){
while(nodes--){
node=document.createElement('div');
node.id=testnames ? testnames[nodes]:mod + (nodes + 1);
div.appendChild(node);
}}
style=['',''].join('');
div.id=mod;
(body ? div:fakeBody).innerHTML +=style;
fakeBody.appendChild(div);
if(!body){
fakeBody.style.background='';
fakeBody.style.overflow='hidden';
docOverflow=docElement.style.overflow;
docElement.style.overflow='hidden';
docElement.appendChild(fakeBody);
}
ret=callback(div, rule);
if(!body){
fakeBody.parentNode.removeChild(fakeBody);
docElement.style.overflow=docOverflow;
}else{
div.parentNode.removeChild(div);
}
return !!ret;
},
testMediaQuery=function(mq){
var matchMedia=window.matchMedia||window.msMatchMedia;
if(matchMedia){
return matchMedia(mq).matches;
}
var bool;
injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; }}', function(node){
bool=(window.getComputedStyle ?
getComputedStyle(node, null) :
node.currentStyle)['position']=='absolute';
});
return bool;
},
isEventSupported=(function(){
var TAGNAMES={
'select': 'input', 'change': 'input',
'submit': 'form', 'reset': 'form',
'error': 'img', 'load': 'img', 'abort': 'img'
};
function isEventSupported(eventName, element){
element=element||document.createElement(TAGNAMES[eventName]||'div');
eventName='on' + eventName;
var isSupported=eventName in element;
if(!isSupported){
if(!element.setAttribute){
element=document.createElement('div');
}
if(element.setAttribute&&element.removeAttribute){
element.setAttribute(eventName, '');
isSupported=is(element[eventName], 'function');
if(!is(element[eventName], 'undefined')){
element[eventName]=undefined;
}
element.removeAttribute(eventName);
}}
element=null;
return isSupported;
}
return isEventSupported;
})(),
_hasOwnProperty=({}).hasOwnProperty, hasOwnProp;
if(!is(_hasOwnProperty, 'undefined')&&!is(_hasOwnProperty.call, 'undefined')){
hasOwnProp=function (object, property){
return _hasOwnProperty.call(object, property);
};}else{
hasOwnProp=function (object, property){
return ((property in object)&&is(object.constructor.prototype[property], 'undefined'));
};}
if(!Function.prototype.bind){
Function.prototype.bind=function bind(that){
var target=this;
if(typeof target!="function"){
throw new TypeError();
}
var args=slice.call(arguments, 1),
bound=function (){
if(this instanceof bound){
var F=function(){};
F.prototype=target.prototype;
var self=new F();
var result=target.apply(self,
args.concat(slice.call(arguments))
);
if(Object(result)===result){
return result;
}
return self;
}else{
return target.apply(that,
args.concat(slice.call(arguments))
);
}};
return bound;
};}
function setCss(str){
mStyle.cssText=str;
}
function setCssAll(str1, str2){
return setCss(prefixes.join(str1 + ';') +(str2||''));
}
function is(obj, type){
return typeof obj===type;
}
function contains(str, substr){
return !!~('' + str).indexOf(substr);
}
function testProps(props, prefixed){
for(var i in props){
var prop=props[i];
if(!contains(prop, "-")&&mStyle[prop]!==undefined){
return prefixed=='pfx' ? prop:true;
}}
return false;
}
function testDOMProps(props, obj, elem){
for(var i in props){
var item=obj[props[i]];
if(item!==undefined){
if(elem===false) return props[i];
if(is(item, 'function')){
return item.bind(elem||obj);
}
return item;
}}
return false;
}
function testPropsAll(prop, prefixed, elem){
var ucProp=prop.charAt(0).toUpperCase() + prop.slice(1),
props=(prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');
if(is(prefixed, "string")||is(prefixed, "undefined")){
return testProps(props, prefixed);
}else{
props=(prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');
return testDOMProps(props, prefixed, elem);
}} tests['flexbox']=function(){
return testPropsAll('flexWrap');
}; tests['canvas']=function(){
var elem=document.createElement('canvas');
return !!(elem.getContext&&elem.getContext('2d'));
};
tests['canvastext']=function(){
return !!(Modernizr['canvas']&&is(document.createElement('canvas').getContext('2d').fillText, 'function'));
};
tests['webgl']=function(){
return !!window.WebGLRenderingContext;
};
tests['touch']=function(){
var bool;
if(('ontouchstart' in window)||window.DocumentTouch&&document instanceof DocumentTouch){
bool=true;
}else{
injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function(node){
bool=node.offsetTop===9;
});
}
return bool;
};
tests['geolocation']=function(){
return 'geolocation' in navigator;
};
tests['postmessage']=function(){
return !!window.postMessage;
};
tests['websqldatabase']=function(){
return !!window.openDatabase;
};
tests['indexedDB']=function(){
return !!testPropsAll("indexedDB", window);
};
tests['hashchange']=function(){
return isEventSupported('hashchange', window)&&(document.documentMode===undefined||document.documentMode > 7);
};
tests['history']=function(){
return !!(window.history&&history.pushState);
};
tests['draganddrop']=function(){
var div=document.createElement('div');
return ('draggable' in div)||('ondragstart' in div&&'ondrop' in div);
};
tests['websockets']=function(){
return 'WebSocket' in window||'MozWebSocket' in window;
};
tests['rgba']=function(){
setCss('background-color:rgba(150,255,150,.5)');
return contains(mStyle.backgroundColor, 'rgba');
};
tests['hsla']=function(){
setCss('background-color:hsla(120,40%,100%,.5)');
return contains(mStyle.backgroundColor, 'rgba')||contains(mStyle.backgroundColor, 'hsla');
};
tests['multiplebgs']=function(){
setCss('background:url(https://),url(https://),red url(https://)');
return (/(url\s*\(.*?){3}/).test(mStyle.background);
}; tests['backgroundsize']=function(){
return testPropsAll('backgroundSize');
};
tests['borderimage']=function(){
return testPropsAll('borderImage');
};
tests['borderradius']=function(){
return testPropsAll('borderRadius');
};
tests['boxshadow']=function(){
return testPropsAll('boxShadow');
};
tests['textshadow']=function(){
return document.createElement('div').style.textShadow==='';
};
tests['opacity']=function(){
setCssAll('opacity:.55');
return (/^0.55$/).test(mStyle.opacity);
};
tests['cssanimations']=function(){
return testPropsAll('animationName');
};
tests['csscolumns']=function(){
return testPropsAll('columnCount');
};
tests['cssgradients']=function(){
var str1='background-image:',
str2='gradient(linear,left top,right bottom,from(#9f9),to(white));',
str3='linear-gradient(left top,#9f9, white);';
setCss(
(str1 + '-webkit- '.split(' ').join(str2 + str1) +
prefixes.join(str3 + str1)).slice(0, -str1.length)
);
return contains(mStyle.backgroundImage, 'gradient');
};
tests['cssreflections']=function(){
return testPropsAll('boxReflect');
};
tests['csstransforms']=function(){
return !!testPropsAll('transform');
};
tests['csstransforms3d']=function(){
var ret = !!testPropsAll('perspective');
if(ret&&'webkitPerspective' in docElement.style){
injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function(node, rule){
ret=node.offsetLeft===9&&node.offsetHeight===3;
});
}
return ret;
};
tests['csstransitions']=function(){
return testPropsAll('transition');
};
tests['fontface']=function(){
var bool;
injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function(node, rule){
var style=document.getElementById('smodernizr'),
sheet=style.sheet||style.styleSheet,
cssText=sheet ? (sheet.cssRules&&sheet.cssRules[0] ? sheet.cssRules[0].cssText:sheet.cssText||''):'';
bool=/src/i.test(cssText)&&cssText.indexOf(rule.split(' ')[0])===0;
});
return bool;
};
tests['generatedcontent']=function(){
var bool;
injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function(node){
bool=node.offsetHeight >=3;
});
return bool;
};
tests['video']=function(){
var elem=document.createElement('video'),
bool=false;
try {
if(bool = !!elem.canPlayType){
bool=new Boolean(bool);
bool.ogg=elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,'');
bool.h264=elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,'');
bool.webm=elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');
}} catch(e){ }
return bool;
};
tests['audio']=function(){
var elem=document.createElement('audio'),
bool=false;
try {
if(bool = !!elem.canPlayType){
bool=new Boolean(bool);
bool.ogg=elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');
bool.mp3=elem.canPlayType('audio/mpeg;') .replace(/^no$/,'');
bool.wav=elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,'');
bool.m4a=(elem.canPlayType('audio/x-m4a;') ||
elem.canPlayType('audio/aac;')) .replace(/^no$/,'');
}} catch(e){ }
return bool;
};
tests['localstorage']=function(){
try {
localStorage.setItem(mod, mod);
localStorage.removeItem(mod);
return true;
} catch(e){
return false;
}};
tests['sessionstorage']=function(){
try {
sessionStorage.setItem(mod, mod);
sessionStorage.removeItem(mod);
return true;
} catch(e){
return false;
}};
tests['webworkers']=function(){
return !!window.Worker;
};
tests['applicationcache']=function(){
return !!window.applicationCache;
};
tests['svg']=function(){
return !!document.createElementNS&&!!document.createElementNS(ns.svg, 'svg').createSVGRect;
};
tests['inlinesvg']=function(){
var div=document.createElement('div');
div.innerHTML='';
return (div.firstChild&&div.firstChild.namespaceURI)==ns.svg;
};
tests['smil']=function(){
return !!document.createElementNS&&/SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate')));
};
tests['svgclippaths']=function(){
return !!document.createElementNS&&/SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath')));
};
function webforms(){
Modernizr['input']=(function(props){
for(var i=0, len=props.length; i < len; i++){
attrs[ props[i] ] = !!(props[i] in inputElem);
}
if(attrs.list){
attrs.list = !!(document.createElement('datalist')&&window.HTMLDataListElement);
}
return attrs;
})('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));
Modernizr['inputtypes']=(function(props){
for(var i=0, bool, inputElemType, defaultView, len=props.length; i < len; i++){
inputElem.setAttribute('type', inputElemType=props[i]);
bool=inputElem.type!=='text';
if(bool){
inputElem.value=smile;
inputElem.style.cssText='position:absolute;visibility:hidden;';
if(/^range$/.test(inputElemType)&&inputElem.style.WebkitAppearance!==undefined){
docElement.appendChild(inputElem);
defaultView=document.defaultView;
bool=defaultView.getComputedStyle &&
defaultView.getComputedStyle(inputElem, null).WebkitAppearance!=='textfield' &&
(inputElem.offsetHeight!==0);
docElement.removeChild(inputElem);
}else if(/^(search|tel)$/.test(inputElemType)){
}else if(/^(url|email)$/.test(inputElemType)){
bool=inputElem.checkValidity&&inputElem.checkValidity()===false;
}else{
bool=inputElem.value!=smile;
}}
inputs[ props[i] ] = !!bool;
}
return inputs;
})('search tel url email datetime date month week time datetime-local number range color'.split(' '));
}
for(var feature in tests){
if(hasOwnProp(tests, feature)){
featureName=feature.toLowerCase();
Modernizr[featureName]=tests[feature]();
classes.push((Modernizr[featureName] ? '':'no-') + featureName);
}}
Modernizr.input||webforms();
Modernizr.addTest=function(feature, test){
if(typeof feature=='object'){
for(var key in feature){
if(hasOwnProp(feature, key)){
Modernizr.addTest(key, feature[ key ]);
}}
}else{
feature=feature.toLowerCase();
if(Modernizr[feature]!==undefined){
return Modernizr;
}
test=typeof test=='function' ? test():test;
if(typeof enableClasses!=="undefined"&&enableClasses){
docElement.className +=' ' + (test ? '':'no-') + feature;
}
Modernizr[feature]=test;
}
return Modernizr;
};
setCss('');
modElem=inputElem=null;
Modernizr._version=version;
Modernizr._prefixes=prefixes;
Modernizr._domPrefixes=domPrefixes;
Modernizr._cssomPrefixes=cssomPrefixes;
Modernizr.mq=testMediaQuery;
Modernizr.hasEvent=isEventSupported;
Modernizr.testProp=function(prop){
return testProps([prop]);
};
Modernizr.testAllProps=testPropsAll;
Modernizr.testStyles=injectElementWithStyles;
Modernizr.prefixed=function(prop, obj, elem){
if(!obj){
return testPropsAll(prop, 'pfx');
}else{
return testPropsAll(prop, obj, elem);
}};
docElement.className=docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') +
(enableClasses ? ' js ' + classes.join(' '):'');
return Modernizr;
})(this, this.document);
(function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f'),
loader: $(''),
toolbar: $(''),
innerToolbar: $(''),
title: $(''),
closeButton: $(''),
fullScreenButton: $(''),
innerPlayButton: $(''),
innerNextButton: $(''),
innerPrevButton: $(''),
holder: $(''),
nextPhoto: $(''),
prevPhoto: $(''),
nextButton: $(''),
prevButton: $(''),
thumbnails: $(''),
thumbs: false,
nextLock: false,
prevLock: false,
hashLock: false,
isMobile: false,
mobileMaxWidth: 980,
isInFullScreen: false,
isSwipe: false,
mouseID: 0,
cycleID: 0,
isPaused: 0
};
iL.vars.hideableElements=iL.vars.nextButton.add(iL.vars.prevButton);
iL.normalizeItems();
iL.availPlugins();
iL.options.startFrom=(iL.options.startFrom > 0&&iL.options.startFrom >=iL.vars.total) ? iL.vars.total - 1:iL.options.startFrom;
iL.options.startFrom=(iL.options.randomStart) ? floor(random() * iL.vars.total):iL.options.startFrom;
iL.vars.start=iL.options.startFrom;
if(instant){ iL.instantCall(); }else{ iL.patchItemsEvents(); }
if(iL.options.linkId){
iL.hashChangeHandler();
$win.iLightBoxHashChange(function(){
iL.hashChangeHandler();
});
}
if(supportTouch){
var RegExp=/(click|mouseenter|mouseleave|mouseover|mouseout)/ig,
replace="itap";
iL.options.caption.show=iL.options.caption.show.replace(RegExp, replace),
iL.options.caption.hide=iL.options.caption.hide.replace(RegExp, replace),
iL.options.social.show=iL.options.social.show.replace(RegExp, replace),
iL.options.social.hide=iL.options.social.hide.replace(RegExp, replace);
}
if(iL.options.controls.arrows){
$.extend(iL.options.styles, {
nextOffsetX: 0,
prevOffsetX: 0,
nextOpacity: 0,
prevOpacity: 0
});
}};
iLightBox.prototype={
showLoader: function(){
var iL=this;
iL.vars.loadRequests +=1;
if(iL.options.path.toLowerCase()=="horizontal"){ iL.vars.loader.stop().animate({
top: '-30px'
}, iL.options.show.speed, 'easeOutCirc'); }else{ iL.vars.loader.stop().animate({
left: '-30px'
}, iL.options.show.speed, 'easeOutCirc'); }},
hideLoader: function(){
var iL=this;
iL.vars.loadRequests -=1;
iL.vars.loadRequests=(iL.vars.loadRequests < 0) ? 0:iL.vars.loadRequests;
if(iL.options.path.toLowerCase()=="horizontal"){
if(iL.vars.loadRequests <=0){
iL.vars.loader.stop().animate({
top: '-192px'
}, iL.options.show.speed, 'easeInCirc');
}}else{
if(iL.vars.loadRequests <=0){
iL.vars.loader.stop().animate({
left: '-192px'
}, iL.options.show.speed, 'easeInCirc');
}}
},
createUI: function(){
var iL=this;
iL.ui={
currentElement: iL.vars.holder,
nextElement: iL.vars.nextPhoto,
prevElement: iL.vars.prevPhoto,
currentItem: iL.vars.current,
nextItem: iL.vars.next,
prevItem: iL.vars.prev,
hide: function(){
iL.closeAction();
},
refresh: function(){
(arguments.length > 0) ? iL.repositionPhoto(true): iL.repositionPhoto();
},
fullscreen: function(){
iL.fullScreenAction();
}};},
attachItems: function(){
var iL=this,
itemsObject=new Array(),
items=new Array();
$(iL.selector, iL.context).each(function(){
var t=$(this),
URL=t.attr(iL.options.attr)||null,
options=t.data("options")&&eval("({" + t.data("options") + "})")||{},
caption=t.data('caption'),
title=t.data('title'),
type=t.data('type')||getTypeByExtension(URL);
items.push({
URL: URL,
caption: caption,
title: title,
type: type,
options: options
});
if(!iL.instant){ itemsObject.push(t); }});
iL.items=items,
iL.itemsObject=itemsObject;
if(iL.vars){
iL.vars.total=items.length;
}},
normalizeItems: function(){
var iL=this,
newItems=new Array();
$.each(iL.items, function(key, val){
if(typeof val=="string"){
val={
url: val
};}
var URL=val.url||val.URL||null,
options=val.options||{},
caption=val.caption||null,
title=val.title||null,
type=(val.type) ? val.type.toLowerCase():getTypeByExtension(URL),
ext=(typeof URL!='object') ? getExtension(URL):'';
options.thumbnail=options.thumbnail||((type=="image") ? URL:null),
options.videoType=options.videoType||null,
options.skin=options.skin||iL.options.skin,
options.width=options.width||null,
options.height=options.height||null,
options.mousewheel=(typeof options.mousewheel!='undefined') ? options.mousewheel:true,
options.swipe=(typeof options.swipe!='undefined') ? options.swipe:true,
options.social=(typeof options.social!='undefined') ? options.social:iL.options.social.buttons&&$.extend({}, {}, iL.options.social.buttons);
if(type=="video"){
options.html5video=(typeof options.html5video!='undefined') ? options.html5video:{};
options.html5video.webm=options.html5video.webm||options.html5video.WEBM||null;
options.html5video.controls=(typeof options.html5video.controls!='undefined') ? options.html5video.controls:"controls";
options.html5video.preload=options.html5video.preload||"metadata";
options.html5video.autoplay=(typeof options.html5video.autoplay!='undefined') ? options.html5video.autoplay:false;
}
if(!options.width||!options.height){
if(type=="video"){ options.width=js_local_vars.lightbox_video_width, options.height=js_local_vars.lightbox_video_height; }
else if(type=="iframe"){ options.width=js_local_vars.lightbox_video_width, options.height=js_local_vars.lightbox_video_height; }
else if(type=="flash"){ options.width=js_local_vars.lightbox_video_width, options.height=js_local_vars.lightbox_video_height; }}
delete val.url;
val.index=key;
val.URL=URL;
val.caption=caption;
val.title=title;
val.type=type;
val.options=options;
val.ext=ext;
newItems.push(val);
});
iL.items=newItems;
},
instantCall: function(){
var iL=this,
key=iL.vars.start;
iL.vars.current=key;
iL.vars.next=(iL.items[key + 1]) ? key + 1:null;
iL.vars.prev=(iL.items[key - 1]) ? key - 1:null;
iL.addContents();
iL.patchEvents();
},
addContents: function(){
var iL=this,
vars=iL.vars,
opts=iL.options,
viewport=getViewport(),
path=opts.path.toLowerCase(),
recognizingItems=vars.total > 0&&iL.items.filter(function(e, i, arr){
return ['image', 'flash', 'video'].indexOf(e.type)===-1&&typeof e.recognized==='undefined'&&(opts.smartRecognition||e.options.smartRecognition);
}),
needRecognition=recognizingItems.length > 0;
if(opts.mobileOptimizer&&!opts.innerToolbar){
vars.isMobile=viewport.width <=vars.mobileMaxWidth;
}
vars.overlay.addClass(opts.skin).hide().css('opacity', opts.overlay.opacity);
if(opts.linkId){
vars.overlay[0].setAttribute('linkid', opts.linkId);
}
if(opts.controls.toolbar){
vars.toolbar.addClass(opts.skin).append(vars.closeButton);
if(opts.controls.fullscreen){
vars.toolbar.append(vars.fullScreenButton);
}
if(opts.controls.slideshow){
vars.toolbar.append(vars.innerPlayButton);
}
if(vars.total > 1){
vars.toolbar.append(vars.innerPrevButton).append(vars.innerNextButton);
}}
vars.BODY.addClass('ilightbox-noscroll').append(vars.overlay).append(vars.loader).append(vars.holder).append(vars.nextPhoto).append(vars.prevPhoto);
if(!opts.innerToolbar){
vars.BODY.append(vars.toolbar);
}
if(opts.controls.arrows){
vars.BODY.append(vars.nextButton).append(vars.prevButton);
}
if(opts.controls.thumbnail&&vars.total > 1){
vars.BODY.append(vars.thumbnails);
vars.thumbnails.addClass(opts.skin).addClass('ilightbox-' + path);
$('div.ilightbox-thumbnails-grid', vars.thumbnails).empty();
vars.thumbs=true;
}
var loaderCss=(opts.path.toLowerCase()=="horizontal") ? {
left: parseInt((viewport.width / 2) - (vars.loader.outerWidth() / 2))
}:{
top: parseInt((viewport.height / 2) - (vars.loader.outerHeight() / 2))
};
vars.loader.addClass(opts.skin).css(loaderCss);
vars.nextButton.add(vars.prevButton).addClass(opts.skin);
if(path=="horizontal"){
vars.loader.add(vars.nextButton).add(vars.prevButton).addClass('horizontal');
}
vars.BODY[vars.isMobile ? 'addClass':'removeClass']('isMobile');
if(!opts.infinite){
vars.prevButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled');
vars.nextButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled');
if(vars.current==0){
vars.prevButton.add(vars.innerPrevButton).addClass('disabled');
}
if(vars.current >=vars.total - 1){
vars.nextButton.add(vars.innerNextButton).addClass('disabled');
}}
if(opts.show.effect){
vars.overlay.stop().fadeIn(opts.show.speed);
vars.toolbar.stop().fadeIn(opts.show.speed);
}else{
vars.overlay.show();
vars.toolbar.show();
}
var length=recognizingItems.length;
if(needRecognition){
iL.showLoader();
$.each(recognizingItems, function(key, val){
var resultFnc=function(result){
var key=-1,
filter=iL.items.filter(function(e, i, arr){
if(e.URL==result.url){
key=i;
}
return e.URL==result.url;
}),
self=iL.items[key];
if(result){
$.extend(true, self, {
URL: result.source,
type: result.type,
recognized: true,
options: {
html5video: result.html5video,
width: (result.type=="image") ? 0:(result.width||self.width),
height: (result.type=="image") ? 0:(result.height||self.height),
thumbnail: self.options.thumbnail||result.thumbnail
}});
}
length--;
if(length==0){
iL.hideLoader();
vars.dontGenerateThumbs=false;
iL.generateThumbnails();
if(opts.show.effect){
setTimeout(function(){
iL.generateBoxes();
}, opts.show.speed);
}else{
iL.generateBoxes();
}}
};
iL.ogpRecognition(this, resultFnc);
});
}else{
if(opts.show.effect){
setTimeout(function(){
iL.generateBoxes();
}, opts.show.speed);
}else{
iL.generateBoxes();
}}
iL.createUI();
window.iLightBox={
close: function(){
iL.closeAction();
},
fullscreen: function(){
iL.fullScreenAction();
},
moveNext: function(){
iL.moveTo('next');
},
movePrev: function(){
iL.moveTo('prev');
},
goTo: function(index){
iL.goTo(index);
},
refresh: function(){
iL.refresh();
},
reposition: function(){
(arguments.length > 0) ? iL.repositionPhoto(true): iL.repositionPhoto();
},
setOption: function(options){
iL.setOption(options);
},
destroy: function(){
iL.closeAction();
iL.dispatchItemsEvents();
}};
if(opts.linkId){
vars.hashLock=true;
window.location.hash=opts.linkId + '/' + vars.current;
setTimeout(function(){
vars.hashLock=false;
}, 55);
}
if(!opts.slideshow.startPaused){
iL.resume();
vars.innerPlayButton.removeClass('ilightbox-play').addClass('ilightbox-pause');
}
if(typeof iL.options.callback.onOpen=='function'){ iL.options.callback.onOpen.call(iL); }},
loadContent: function(obj, opt, speed){
var iL=this,
holder, item;
iL.createUI();
obj.speed=speed||iL.options.effects.loadedFadeSpeed;
if(opt=='current'){
if(!obj.options.mousewheel){ iL.vars.lockWheel=true; }else{ iL.vars.lockWheel=false; }
if(!obj.options.swipe){ iL.vars.lockSwipe=true; }else{ iL.vars.lockSwipe=false; }}
switch (opt){
case 'current':
holder=iL.vars.holder, item=iL.vars.current;
break;
case 'next':
holder=iL.vars.nextPhoto, item=iL.vars.next;
break;
case 'prev':
holder=iL.vars.prevPhoto, item=iL.vars.prev;
break;
}
holder.removeAttr('style class').addClass('ilightbox-holder' + (supportTouch ? ' supportTouch':'')).addClass(obj.options.skin);
$('div.ilightbox-inner-toolbar', holder).remove();
if(obj.title||iL.options.innerToolbar){
var innerToolbar=iL.vars.innerToolbar.clone();
if(obj.title&&iL.options.show.title){
var title=iL.vars.title.clone();
title.empty().html(obj.title);
innerToolbar.append(title);
}
if(iL.options.innerToolbar){
innerToolbar.append((iL.vars.total > 1) ? iL.vars.toolbar.clone():iL.vars.toolbar);
}
holder.prepend(innerToolbar);
}
iL.loadSwitcher(obj, holder, item, opt);
},
loadSwitcher: function(obj, holder, item, opt){
var iL=this,
opts=iL.options,
api={
element: holder,
position: item
};
switch (obj.type){
case 'image':
if(typeof opts.callback.onBeforeLoad=='function'){ opts.callback.onBeforeLoad.call(iL, iL.ui, item); }
if(typeof obj.options.onBeforeLoad=='function'){ obj.options.onBeforeLoad.call(iL, api); }
iL.loadImage(obj.URL, function(img){
if(typeof opts.callback.onAfterLoad=='function'){ opts.callback.onAfterLoad.call(iL, iL.ui, item); }
if(typeof obj.options.onAfterLoad=='function'){ obj.options.onAfterLoad.call(iL, api); }
var width=(img) ? img.width:400,
height=(img) ? img.height:200;
holder.data({
naturalWidth: width,
naturalHeight: height
});
$('div.ilightbox-container', holder).empty().append((img) ? '':'' + opts.errors.loadImage + '');
if(typeof opts.callback.onRender=='function'){ opts.callback.onRender.call(iL, iL.ui, item); }
if(typeof obj.options.onRender=='function'){ obj.options.onRender.call(iL, api); }
iL.configureHolder(obj, opt, holder);
});
break;
case 'video':
holder.data({
naturalWidth: obj.options.width,
naturalHeight: obj.options.height
});
iL.addContent(holder, obj);
if(typeof opts.callback.onRender=='function'){ opts.callback.onRender.call(iL, iL.ui, item); }
if(typeof obj.options.onRender=='function'){ obj.options.onRender.call(iL, api); }
iL.configureHolder(obj, opt, holder);
break;
case 'iframe':
var $query_array=obj.URL.substring(obj.URL.indexOf('?') + 1).split('&'),
$query_object={};
for(var $i=0; $i < $query_array.length; ++$i){
var $single_query=$query_array[$i].split('=');
if($single_query.length!=2) continue;
if($single_query[0]=='w'){
$single_query[0]='width';
}
if($single_query[0]=='h'){
$single_query[0]='height';
}
$query_object[$single_query[0]]=decodeURIComponent($single_query[1].replace(/\+/g, " "));
}
iL.showLoader();
holder.data({
naturalWidth:($query_object['width']) ? $query_object['width']:obj.options.width,
naturalHeight:($query_object['height']) ? $query_object['height']:obj.options.height
});
var el=iL.addContent(holder, obj);
if(typeof opts.callback.onRender=='function'){ opts.callback.onRender.call(iL, iL.ui, item); }
if(typeof obj.options.onRender=='function'){ obj.options.onRender.call(iL, api); }
if(typeof opts.callback.onBeforeLoad=='function'){ opts.callback.onBeforeLoad.call(iL, iL.ui, item); }
if(typeof obj.options.onBeforeLoad=='function'){ obj.options.onBeforeLoad.call(iL, api); }
el.bind('load', function(){
if(typeof opts.callback.onAfterLoad=='function'){ opts.callback.onAfterLoad.call(iL, iL.ui, item); }
if(typeof obj.options.onAfterLoad=='function'){ obj.options.onAfterLoad.call(iL, api); }
iL.hideLoader();
iL.configureHolder(obj, opt, holder);
el.unbind('load');
});
break;
case 'inline':
var el=$(obj.URL),
content=iL.addContent(holder, obj),
images=findImageInElement(holder);
holder.data({
naturalWidth: (iL.items[item].options.width||el.outerWidth()),
naturalHeight: (iL.items[item].options.height||el.outerHeight())
});
content.children().eq(0).show();
if(typeof opts.callback.onRender=='function'){ opts.callback.onRender.call(iL, iL.ui, item); }
if(typeof obj.options.onRender=='function'){ obj.options.onRender.call(iL, api); }
if(typeof opts.callback.onBeforeLoad=='function'){ opts.callback.onBeforeLoad.call(iL, iL.ui, item); }
if(typeof obj.options.onBeforeLoad=='function'){ obj.options.onBeforeLoad.call(iL, api); }
iL.loadImage(images, function(){
if(typeof opts.callback.onAfterLoad=='function'){ opts.callback.onAfterLoad.call(iL, iL.ui, item); }
if(typeof obj.options.onAfterLoad=='function'){ obj.options.onAfterLoad.call(iL, api); }
iL.configureHolder(obj, opt, holder);
});
break;
case 'flash':
var el=iL.addContent(holder, obj);
holder.data({
naturalWidth: (iL.items[item].options.width||el.outerWidth()),
naturalHeight: (iL.items[item].options.height||el.outerHeight())
});
if(typeof opts.callback.onRender=='function'){ opts.callback.onRender.call(iL, iL.ui, item); }
if(typeof obj.options.onRender=='function'){ obj.options.onRender.call(iL, api); }
iL.configureHolder(obj, opt, holder);
break;
case 'ajax':
var ajax=obj.options.ajax||{};
if(typeof opts.callback.onBeforeLoad=='function'){ opts.callback.onBeforeLoad.call(iL, iL.ui, item); }
if(typeof obj.options.onBeforeLoad=='function'){ obj.options.onBeforeLoad.call(iL, api); }
iL.showLoader();
$.ajax({
url: obj.URL||opts.ajaxSetup.url,
data: ajax.data||null,
dataType: ajax.dataType||"html",
type: ajax.type||opts.ajaxSetup.type,
cache: ajax.cache||opts.ajaxSetup.cache,
crossDomain: ajax.crossDomain||opts.ajaxSetup.crossDomain,
global: ajax.global||opts.ajaxSetup.global,
ifModified: ajax.ifModified||opts.ajaxSetup.ifModified,
username: ajax.username||opts.ajaxSetup.username,
password: ajax.password||opts.ajaxSetup.password,
beforeSend: ajax.beforeSend||opts.ajaxSetup.beforeSend,
complete: ajax.complete||opts.ajaxSetup.complete,
success: function(data, textStatus, jqXHR){
iL.hideLoader();
var el=$(data),
container=$('div.ilightbox-container', holder),
elWidth=iL.items[item].options.width||parseInt(el[0].getAttribute('width')),
elHeight=iL.items[item].options.height||parseInt(el[0].getAttribute('height')),
css=(el[0].getAttribute('width')&&el[0].getAttribute('height')) ? {
'overflow': 'hidden'
}:{};
container.empty().append($('').css(css).html(el));
holder.show().data({
naturalWidth: (elWidth||container.outerWidth()),
naturalHeight: (elHeight||container.outerHeight())
}).hide();
if(typeof opts.callback.onRender=='function'){ opts.callback.onRender.call(iL, iL.ui, item); }
if(typeof obj.options.onRender=='function'){ obj.options.onRender.call(iL, api); }
var images=findImageInElement(holder);
iL.loadImage(images, function(){
if(typeof opts.callback.onAfterLoad=='function'){ opts.callback.onAfterLoad.call(iL, iL.ui, item); }
if(typeof obj.options.onAfterLoad=='function'){ obj.options.onAfterLoad.call(iL, api); }
iL.configureHolder(obj, opt, holder);
});
opts.ajaxSetup.success(data, textStatus, jqXHR);
if(typeof ajax.success=='function'){ ajax.success(data, textStatus, jqXHR); }},
error: function(jqXHR, textStatus, errorThrown){
if(typeof opts.callback.onAfterLoad=='function'){ opts.callback.onAfterLoad.call(iL, iL.ui, item); }
if(typeof obj.options.onAfterLoad=='function'){ obj.options.onAfterLoad.call(iL, api); }f
iL.hideLoader();
$('div.ilightbox-container', holder).empty().append('' + opts.errors.loadContents + '');
iL.configureHolder(obj, opt, holder);
opts.ajaxSetup.error(jqXHR, textStatus, errorThrown);
if(typeof ajax.error=='function'){ ajax.error(jqXHR, textStatus, errorThrown); }}
});
break;
case 'html':
var object=obj.URL,
el
container=$('div.ilightbox-container', holder);
if(object[0].nodeName){ el=object.clone(); }else{
var dom=$(object);
if(dom.selector){ el=$('' + dom + '
'); }else{ el=dom; }}
var elWidth=iL.items[item].options.width||parseInt(el.attr('width')),
elHeight=iL.items[item].options.height||parseInt(el.attr('height'));
iL.addContent(holder, obj);
el.appendTo(document.documentElement).hide();
if(typeof opts.callback.onRender=='function'){ opts.callback.onRender.call(iL, iL.ui, item); }
if(typeof obj.options.onRender=='function'){ obj.options.onRender.call(iL, api); }
var images=findImageInElement(holder);
if(typeof opts.callback.onBeforeLoad=='function'){ opts.callback.onBeforeLoad.call(iL, iL.ui, item); }
if(typeof obj.options.onBeforeLoad=='function'){ obj.options.onBeforeLoad.call(iL, api); }
iL.loadImage(images, function(){
if(typeof opts.callback.onAfterLoad=='function'){ opts.callback.onAfterLoad.call(iL, iL.ui, item); }
if(typeof obj.options.onAfterLoad=='function'){ obj.options.onAfterLoad.call(iL, api); }
holder.show().data({
naturalWidth: (elWidth||container.outerWidth()),
naturalHeight: (elHeight||container.outerHeight())
}).hide();
el.remove();
iL.configureHolder(obj, opt, holder);
});
break;
}},
configureHolder: function(obj, opt, holder){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(opt!="current")(opt=="next") ? holder.addClass('ilightbox-next'):holder.addClass('ilightbox-prev');
if(opt=="current"){
var item=vars.current;
}else if(opt=="next"){
var opacity=opts.styles.nextOpacity,
item=vars.next;
}else{
var opacity=opts.styles.prevOpacity,
item=vars.prev;
}
var api={
element: holder,
position: item
};
iL.items[item].options.width=iL.items[item].options.width||0,
iL.items[item].options.height=iL.items[item].options.height||0;
if(opt=="current"){
if(opts.show.effect){ holder.css(transform, gpuAcceleration).fadeIn(obj.speed, function(){
holder.css(transform, '');
if(obj.caption){
iL.setCaption(obj, holder);
var caption=$('div.ilightbox-caption', holder),
percent=parseInt((caption.outerHeight() / holder.outerHeight()) * 100);
if(opts.caption.start & percent <=50){ caption.fadeIn(opts.effects.fadeSpeed); }}
var social=obj.options.social;
if(social){
iL.setSocial(social, obj.URL, holder);
if(opts.social.start){ $('div.ilightbox-social', holder).fadeIn(opts.effects.fadeSpeed); }}
iL.generateThumbnails();
if(typeof opts.callback.onShow=='function'){ opts.callback.onShow.call(iL, iL.ui, item); }
if(typeof obj.options.onShow=='function'){ obj.options.onShow.call(iL, api); }});
}else{
holder.show();
iL.generateThumbnails();
if(typeof opts.callback.onShow=='function'){ opts.callback.onShow.call(iL, iL.ui, item); }
if(typeof obj.options.onShow=='function'){ obj.options.onShow.call(iL, api); }}
}else{
if(opts.show.effect){ holder.fadeTo(obj.speed, opacity, function(){
if(opt=="next"){ vars.nextLock=false; }else{ vars.prevLock=false; }
iL.generateThumbnails();
if(typeof opts.callback.onShow=='function'){ opts.callback.onShow.call(iL, iL.ui, item); }
if(typeof obj.options.onShow=='function'){ obj.options.onShow.call(iL, api); }});
}else{
holder.css({
opacity: opacity
}).show();
if(opt=="next"){ vars.nextLock=false; }else{ vars.prevLock=false; }
iL.generateThumbnails();
if(typeof opts.callback.onShow=='function'){ opts.callback.onShow.call(iL, iL.ui, item); }
if(typeof obj.options.onShow=='function'){ obj.options.onShow.call(iL, api); }}
}
setTimeout(function(){
iL.repositionPhoto();
}, 0);
},
generateBoxes: function(){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(opts.infinite&&vars.total >=3){
if(vars.current==vars.total - 1){ vars.next=0; }
if(vars.current==0){ vars.prev=vars.total - 1; }}else{ opts.infinite=false; }
iL.loadContent(iL.items[vars.current], 'current', opts.show.speed);
if(iL.items[vars.next]){ iL.loadContent(iL.items[vars.next], 'next', opts.show.speed); }
if(iL.items[vars.prev]){ iL.loadContent(iL.items[vars.prev], 'prev', opts.show.speed); }},
generateThumbnails: function(){
var iL=this,
vars=iL.vars,
opts=iL.options,
timeOut=null;
if(vars.thumbs&&!iL.vars.dontGenerateThumbs){
var thumbnails=vars.thumbnails,
container=$('div.ilightbox-thumbnails-container', thumbnails),
grid=$('div.ilightbox-thumbnails-grid', container),
i=0;
grid.removeAttr('style').empty();
$.each(iL.items, function(key, val){
var isActive=(vars.current==key) ? 'ilightbox-active':'',
opacity=(vars.current==key) ? opts.thumbnails.activeOpacity:opts.thumbnails.normalOpacity,
thumb=val.options.thumbnail,
thumbnail=$(''),
icon=$('');
thumbnail.css({
opacity: 0
}).addClass(isActive);
if((val.type=="video"||val.type=="flash")&&typeof val.options.icon=='undefined'){
icon.addClass('ilightbox-thumbnail-video');
thumbnail.append(icon);
}else if(val.options.icon){
icon.addClass('ilightbox-thumbnail-' + val.options.icon);
thumbnail.append(icon);
}
if(thumb){ iL.loadImage(thumb, function(img){
i++;
if(img){ thumbnail.data({
naturalWidth: img.width,
naturalHeight: img.height
}).append('');
}else{ thumbnail.data({
naturalWidth: opts.thumbnails.maxWidth,
naturalHeight: opts.thumbnails.maxHeight
});
}
clearTimeout(timeOut);
timeOut=setTimeout(function(){
iL.positionThumbnails(thumbnails, container, grid);
}, 20);
setTimeout(function(){
thumbnail.fadeTo(opts.effects.loadedFadeSpeed, opacity);
}, i * 20);
});
}
grid.append(thumbnail);
});
iL.vars.dontGenerateThumbs=true;
}},
positionThumbnails: function(thumbnails, container, grid){
var iL=this,
vars=iL.vars,
opts=iL.options,
viewport=getViewport(),
path=opts.path.toLowerCase();
if(!thumbnails){ thumbnails=vars.thumbnails; }
if(!container){ container=$('div.ilightbox-thumbnails-container', thumbnails); }
if(!grid){ grid=$('div.ilightbox-thumbnails-grid', container); }
var thumbs=$('.ilightbox-thumbnail', grid),
widthAvail=(path=='horizontal') ? viewport.width - opts.styles.pageOffsetX:thumbs.eq(0).outerWidth() - opts.styles.pageOffsetX,
heightAvail=(path=='horizontal') ? thumbs.eq(0).outerHeight() - opts.styles.pageOffsetY:viewport.height - opts.styles.pageOffsetY,
gridWidth=(path=='horizontal') ? 0:widthAvail,
gridHeight=(path=='horizontal') ? heightAvail:0,
active=$('.ilightbox-active', grid),
gridCss={},
css={};
if(arguments.length < 3){
thumbs.css({
opacity: opts.thumbnails.normalOpacity
});
active.css({
opacity: opts.thumbnails.activeOpacity
});
}
thumbs.each(function(i){
var t=$(this),
data=t.data(),
width=(path=='horizontal') ? 0:opts.thumbnails.maxWidth;
height=(path=='horizontal') ? opts.thumbnails.maxHeight:0;
dims=iL.getNewDimenstions(width, height, data.naturalWidth, data.naturalHeight, true);
t.css({
width: dims.width,
height: dims.height
});
if(path=='horizontal'){ t.css({
'float': 'left'
});
}
(path=='horizontal') ? (
gridWidth +=t.outerWidth()
):(
gridHeight +=t.outerHeight()
);
});
gridCss={
width: gridWidth,
height: gridHeight
};
grid.css(gridCss);
gridCss={};
var gridOffset=grid.offset(),
activeOffset=(active.length) ? active.offset():{
top: parseInt(heightAvail / 2),
left: parseInt(widthAvail / 2)
};
gridOffset.top=(gridOffset.top - $doc.scrollTop()),
gridOffset.left=(gridOffset.left - $doc.scrollLeft()),
activeOffset.top=(activeOffset.top - gridOffset.top - $doc.scrollTop()),
activeOffset.left=(activeOffset.left - gridOffset.left - $doc.scrollLeft());
(path=='horizontal') ? (
gridCss.top=0,
gridCss.left=parseInt((widthAvail / 2) - activeOffset.left - (active.outerWidth() / 2))
):(
gridCss.top=parseInt(((heightAvail / 2) - activeOffset.top - (active.outerHeight() / 2))),
gridCss.left=0
);
if(arguments.length < 3){ grid.stop().animate(gridCss, opts.effects.repositionSpeed, 'easeOutCirc'); }else{ grid.css(gridCss); }},
loadImage: function(image, callback){
if(!$.isArray(image)){ image=[image]; }
var iL=this,
length=image.length;
if(length > 0){
iL.showLoader();
$.each(image, function(index, value){
var img=new Image();
img.onload=function(){
length -=1;
if(length==0){
iL.hideLoader();
callback(img);
}};
img.onerror=img.onabort=function(){
length -=1;
if(length==0){
iL.hideLoader();
callback(false);
}};
img.src=image[index];
});
} else callback(false);
},
patchItemsEvents: function(){
var iL=this,
vars=iL.vars,
clickEvent=supportTouch ? "itap.iL":"click.iL",
vEvent=supportTouch ? "click.iL":"itap.iL";
if(iL.context&&iL.selector){
var $items=$(iL.selector, iL.context);
$(iL.context).on(clickEvent, iL.selector, function(){
var $this=$(this),
key=$items.index($this);
vars.current=key;
vars.next=iL.items[key + 1] ? key + 1:null;
vars.prev=iL.items[key - 1] ? key - 1:null;
iL.addContents();
iL.patchEvents();
return false;
}).on(vEvent, iL.selector, function(){
return false;
});
}else{
$.each(iL.itemsObject, function(key, val){
val.on(clickEvent, function(){
vars.current=key;
vars.next=iL.items[key + 1] ? key + 1:null;
vars.prev=iL.items[key - 1] ? key - 1:null;
iL.addContents();
iL.patchEvents();
return false;
}).on(vEvent, function(){
return false;
});
});
}},
dispatchItemsEvents: function(){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(iL.context&&iL.selector){
$(iL.context).off('.iL', iL.selector);
}else{
$.each(iL.itemsObject, function(key, val){
val.off('.iL');
});
}},
refresh: function(){
var iL=this;
iL.dispatchItemsEvents();
iL.attachItems();
iL.normalizeItems();
iL.patchItemsEvents();
},
patchEvents: function(){
var iL=this,
vars=iL.vars,
opts=iL.options,
path=opts.path.toLowerCase(),
holders=$('.ilightbox-holder'),
fullscreenEvent=fullScreenApi.fullScreenEventName + '.iLightBox',
durationThreshold=1000,
horizontalDistanceThreshold =
verticalDistanceThreshold=100,
buttonsArray=[vars.nextButton[0], vars.prevButton[0], vars.nextButton[0].firstChild, vars.prevButton[0].firstChild];
$win.bind('resize.iLightBox', function(){
var viewport=getViewport();
if(opts.mobileOptimizer&&!opts.innerToolbar){ vars.isMobile=viewport.width <=vars.mobileMaxWidth; }
vars.BODY[vars.isMobile ? 'addClass':'removeClass']('isMobile');
iL.repositionPhoto(null);
if(supportTouch){
clearTimeout(vars.setTime);
vars.setTime=setTimeout(function(){
var scrollTop=getScrollXY().y;
window.scrollTo(0, scrollTop - 30);
window.scrollTo(0, scrollTop + 30);
window.scrollTo(0, scrollTop);
}, 2000);
}
if(vars.thumbs){ iL.positionThumbnails(); }}).bind('keydown.iLightBox', function(event){
if(opts.controls.keyboard){
switch (event.keyCode){
case 13:
if(event.shiftKey&&opts.keyboard.shift_enter){ iL.fullScreenAction(); }
break;
case 27:
if(opts.keyboard.esc){ iL.closeAction(); }
break;
case 37:
if(opts.keyboard.left&&!vars.lockKey){ iL.moveTo('prev'); }
break;
case 38:
if(opts.keyboard.up&&!vars.lockKey){ iL.moveTo('prev'); }
break;
case 39:
if(opts.keyboard.right&&!vars.lockKey){ iL.moveTo('next'); }
break;
case 40:
if(opts.keyboard.down&&!vars.lockKey){ iL.moveTo('next'); }
break;
}}
});
if(fullScreenApi.supportsFullScreen){ $win.bind(fullscreenEvent, function(){
iL.doFullscreen();
});
}
var holderEventsArr=[opts.caption.show + '.iLightBox', opts.caption.hide + '.iLightBox', opts.social.show + '.iLightBox', opts.social.hide + '.iLightBox'].filter(function(e, i, arr){
return arr.lastIndexOf(e)===i;
}),
holderEvents="";
$.each(holderEventsArr, function(key, val){
if(key!=0){ holderEvents +=' '; }
holderEvents +=val;
});
$doc.on(clickEvent, '.ilightbox-overlay', function(){
if(opts.overlay.blur){ iL.closeAction(); }}).on(clickEvent, '.ilightbox-next, .ilightbox-next-button', function(){
iL.moveTo('next');
}).on(clickEvent, '.ilightbox-prev, .ilightbox-prev-button', function(){
iL.moveTo('prev');
}).on(clickEvent, '.ilightbox-thumbnail', function(){
var t=$(this),
thumbs=$('.ilightbox-thumbnail', vars.thumbnails),
index=thumbs.index(t);
if(index!=vars.current){ iL.goTo(index); }}).on(holderEvents, '.ilightbox-holder:not(.ilightbox-next, .ilightbox-prev)', function(e){
var caption=$('div.ilightbox-caption', vars.holder),
social=$('div.ilightbox-social', vars.holder),
fadeSpeed=opts.effects.fadeSpeed;
if(vars.nextLock||vars.prevLock){
if(e.type==opts.caption.show&&!caption.is(':visible')){ caption.fadeIn(fadeSpeed); }
else if(e.type==opts.caption.hide&&caption.is(':visible')){ caption.fadeOut(fadeSpeed); }
if(e.type==opts.social.show&&!social.is(':visible')){ social.fadeIn(fadeSpeed); }
else if(e.type==opts.social.hide&&social.is(':visible')){ social.fadeOut(fadeSpeed); }}else{
if(e.type==opts.caption.show&&!caption.is(':visible')){ caption.stop().fadeIn(fadeSpeed); }
else if(e.type==opts.caption.hide&&caption.is(':visible')){ caption.stop().fadeOut(fadeSpeed); }
if(e.type==opts.social.show&&!social.is(':visible')){ social.stop().fadeIn(fadeSpeed); }
else if(e.type==opts.social.hide&&social.is(':visible')){ social.stop().fadeOut(fadeSpeed); }}
}).on('mouseenter.iLightBox mouseleave.iLightBox', '.ilightbox-wrapper', function(e){
if(e.type=='mouseenter'){ vars.lockWheel=true; }else{ vars.lockWheel=false; }}).on(clickEvent, '.ilightbox-toolbar a.ilightbox-close, .ilightbox-toolbar a.ilightbox-fullscreen, .ilightbox-toolbar a.ilightbox-play, .ilightbox-toolbar a.ilightbox-pause', function(event){
var t=$(this);
if(t.hasClass('ilightbox-fullscreen')){ iL.fullScreenAction(); }
else if(t.hasClass('ilightbox-play')){
iL.resume();
t.addClass('ilightbox-pause').removeClass('ilightbox-play');
}else if(t.hasClass('ilightbox-pause')){
iL.pause();
t.addClass('ilightbox-play').removeClass('ilightbox-pause');
}else{ iL.closeAction(); }}).on(touchMoveEvent, '.ilightbox-overlay, .ilightbox-thumbnails-container', function(e){
e.preventDefault();
});
function mouseMoveHandler(e){
if(!vars.isMobile){
if(!vars.mouseID){
vars.hideableElements.show();
}
vars.mouseID=clearTimeout(vars.mouseID);
if(buttonsArray.indexOf(e.target)===-1){
vars.mouseID=setTimeout(function(){
vars.hideableElements.hide();
vars.mouseID=clearTimeout(vars.mouseID);
}, 3000);
}}
}
if(opts.controls.arrows&&!supportTouch){ $doc.on('mousemove.iLightBox', mouseMoveHandler); }
if(opts.controls.slideshow&&opts.slideshow.pauseOnHover){ $doc.on('mouseenter.iLightBox mouseleave.iLightBox', '.ilightbox-holder:not(.ilightbox-next, .ilightbox-prev)', function(e){
if(e.type=='mouseenter'&&vars.cycleID){ iL.pause(); }
else if(e.type=='mouseleave'&&vars.isPaused){ iL.resume(); }});
}
var switchers=$('.ilightbox-overlay, .ilightbox-holder, .ilightbox-thumbnails');
if(opts.controls.mousewheel){ switchers.on('mousewheel.iLightBox', function(event, delta){
if(!vars.lockWheel){
event.preventDefault();
if(delta < 0){ iL.moveTo('next'); }
else if(delta > 0){ iL.moveTo('prev'); }}
});
}
if(opts.controls.swipe){ holders.on(touchStartEvent, function(event){
if(vars.nextLock||vars.prevLock||vars.total==1||vars.lockSwipe){ return; }
vars.BODY.addClass('ilightbox-closedhand');
var data=event.originalEvent.touches ? event.originalEvent.touches[0]:event,
scrollTop=$doc.scrollTop(),
scrollLeft=$doc.scrollLeft(),
offsets=[
holders.eq(0).offset(),
holders.eq(1).offset(),
holders.eq(2).offset()
],
offSet=[{
top: offsets[0].top - scrollTop,
left: offsets[0].left - scrollLeft
}, {
top: offsets[1].top - scrollTop,
left: offsets[1].left - scrollLeft
}, {
top: offsets[2].top - scrollTop,
left: offsets[2].left - scrollLeft
}],
start={
time: (new Date()).getTime(),
coords: [data.pageX - scrollLeft, data.pageY - scrollTop]
},
stop;
function moveEachHandler(i){
var t=$(this),
offset=offSet[i],
scroll=[(start.coords[0] - stop.coords[0]), (start.coords[1] - stop.coords[1])];
t[0].style[path=="horizontal" ? 'left':'top']=(path=="horizontal" ? offset.left - scroll[0]:offset.top - scroll[1]) + 'px';
}
function moveHandler(event){
if(!start){ return; }
var data=event.originalEvent.touches ? event.originalEvent.touches[0]:event;
stop={
time: (new Date()).getTime(),
coords: [data.pageX - scrollLeft, data.pageY - scrollTop]
};
holders.each(moveEachHandler);
event.preventDefault();
}
function repositionHolders(){
holders.each(function(){
var t=$(this),
offset=t.data('offset')||{
top: t.offset().top - scrollTop,
left: t.offset().left - scrollLeft
},
top=offset.top,
left=offset.left;
t.css(transform, gpuAcceleration).stop().animate({
top: top,
left: left
}, 500, 'easeOutCirc', function(){
t.css(transform, '');
});
});
}
holders.bind(touchMoveEvent, moveHandler);
$doc.one(touchStopEvent, function(event){
holders.unbind(touchMoveEvent, moveHandler);
vars.BODY.removeClass('ilightbox-closedhand');
if(start&&stop){
if(path=="horizontal"&&stop.time - start.time < durationThreshold&&abs(start.coords[0] - stop.coords[0]) > horizontalDistanceThreshold&&abs(start.coords[1] - stop.coords[1]) < verticalDistanceThreshold){
if(start.coords[0] > stop.coords[0]){
if(vars.current==vars.total - 1&&!opts.infinite){ repositionHolders(); }else{
vars.isSwipe=true;
iL.moveTo('next');
}}else{
if(vars.current==0&&!opts.infinite){ repositionHolders(); }else{
vars.isSwipe=true;
iL.moveTo('prev');
}}
}else if(path=="vertical"&&stop.time - start.time < durationThreshold&&abs(start.coords[1] - stop.coords[1]) > horizontalDistanceThreshold&&abs(start.coords[0] - stop.coords[0]) < verticalDistanceThreshold){
if(start.coords[1] > stop.coords[1]){
if(vars.current==vars.total - 1&&!opts.infinite){ repositionHolders(); }else{
vars.isSwipe=true;
iL.moveTo('next');
}}else{
if(vars.current==0&&!opts.infinite){ repositionHolders(); }else{
vars.isSwipe=true;
iL.moveTo('prev');
}}
}else{ repositionHolders(); }}
start=stop=undefined;
});
});
}},
goTo: function(index){
var iL=this,
vars=iL.vars,
opts=iL.options,
diff=(index - vars.current);
if(opts.infinite){
if(index==vars.total - 1&&vars.current==0){ diff=-1; }
if(vars.current==vars.total - 1&&index==0){ diff=1; }}
if(diff==1){ iL.moveTo('next'); }
else if(diff==-1){ iL.moveTo('prev'); }else{
if(vars.nextLock||vars.prevLock){ return false; }
if(typeof opts.callback.onBeforeChange=='function'){ opts.callback.onBeforeChange.call(iL, iL.ui); }
if(opts.linkId){
vars.hashLock=true;
window.location.hash=opts.linkId + '/' + index;
}
if(iL.items[index]){
if(!iL.items[index].options.mousewheel){ vars.lockWheel=true; }else{ iL.vars.lockWheel=false; }
if(!iL.items[index].options.swipe){ vars.lockSwipe=true; }else{ vars.lockSwipe=false; }}
$.each([vars.holder, vars.nextPhoto, vars.prevPhoto], function(key, val){
val.css(transform, gpuAcceleration).fadeOut(opts.effects.loadedFadeSpeed);
});
vars.current=index;
vars.next=index + 1;
vars.prev=index - 1;
iL.createUI();
setTimeout(function(){
iL.generateBoxes();
}, opts.effects.loadedFadeSpeed + 50);
$('.ilightbox-thumbnail', vars.thumbnails).removeClass('ilightbox-active').eq(index).addClass('ilightbox-active');
iL.positionThumbnails();
if(opts.linkId){ setTimeout(function(){
vars.hashLock=false;
}, 55);
}
if(!opts.infinite){
vars.nextButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled');
if(vars.current==0){
vars.prevButton.add(vars.innerPrevButton).addClass('disabled');
}
if(vars.current >=vars.total - 1){
vars.nextButton.add(vars.innerNextButton).addClass('disabled');
}}
iL.resetCycle();
if(typeof opts.callback.onAfterChange=='function'){ opts.callback.onAfterChange.call(iL, iL.ui); }}
},
moveTo: function(side){
var iL=this,
vars=iL.vars,
opts=iL.options,
path=opts.path.toLowerCase(),
viewport=getViewport(),
switchSpeed=opts.effects.switchSpeed;
if(vars.nextLock||vars.prevLock){ return false; }else{
var item=(side=="next") ? vars.next:vars.prev;
if(opts.linkId){
vars.hashLock=true;
window.location.hash=opts.linkId + '/' + item;
}
if(side=="next"){
if(!iL.items[item]){ return false; }
var firstHolder=vars.nextPhoto,
secondHolder=vars.holder,
lastHolder=vars.prevPhoto,
firstClass='ilightbox-prev',
secondClass='ilightbox-next';
}else if(side=="prev"){
if(!iL.items[item]){ return false; }
var firstHolder=vars.prevPhoto,
secondHolder=vars.holder,
lastHolder=vars.nextPhoto,
firstClass='ilightbox-next',
secondClass='ilightbox-prev';
}
if(typeof opts.callback.onBeforeChange=='function'){
opts.callback.onBeforeChange.call(iL, iL.ui);
}
(side=="next") ? vars.nextLock=true: vars.prevLock=true;
var captionFirst=$('div.ilightbox-caption', secondHolder),
socialFirst=$('div.ilightbox-social', secondHolder);
if(captionFirst.length){
captionFirst.stop().fadeOut(switchSpeed, function(){
$(this).remove();
});
}
if(socialFirst.length){
socialFirst.stop().fadeOut(switchSpeed, function(){
$(this).remove();
});
}
if(iL.items[item].caption){
iL.setCaption(iL.items[item], firstHolder);
var caption=$('div.ilightbox-caption', firstHolder),
percent=parseInt((caption.outerHeight() / firstHolder.outerHeight()) * 100);
if(opts.caption.start&&percent <=50){ caption.fadeIn(switchSpeed); }}
var social=iL.items[item].options.social;
if(social){
iL.setSocial(social, iL.items[item].URL, firstHolder);
if(opts.social.start){ $('div.ilightbox-social', firstHolder).fadeIn(opts.effects.fadeSpeed); }}
$.each([firstHolder, secondHolder, lastHolder], function(key, val){
val.removeClass('ilightbox-next ilightbox-prev');
});
var firstOffset=firstHolder.data('offset'),
winW=(viewport.width - (opts.styles.pageOffsetX)),
winH=(viewport.height - (opts.styles.pageOffsetY)),
width=firstOffset.newDims.width,
height=firstOffset.newDims.height,
thumbsOffset=firstOffset.thumbsOffset,
diff=firstOffset.diff,
top=parseInt((winH / 2) - (height / 2) - diff.H - (thumbsOffset.H / 2)),
left=parseInt((winW / 2) - (width / 2) - diff.W - (thumbsOffset.W / 2));
firstHolder.css(transform, gpuAcceleration).animate({
top: top,
left: left,
opacity: 1
}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc':'easeInOutCirc', function(){
firstHolder.css(transform, '');
});
$('div.ilightbox-container', firstHolder).animate({
width: width,
height: height
}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc':'easeInOutCirc');
var secondOffset=secondHolder.data('offset'),
object=secondOffset.object;
diff=secondOffset.diff;
width=secondOffset.newDims.width,
height=secondOffset.newDims.height;
width=parseInt(width * opts.styles[side=='next' ? 'prevScale':'nextScale']),
height=parseInt(height * opts.styles[side=='next' ? 'prevScale':'nextScale']),
top=(path=='horizontal') ? parseInt((winH / 2) - object.offsetY - (height / 2) - diff.H - (thumbsOffset.H / 2)):parseInt(winH - object.offsetX - diff.H - (thumbsOffset.H / 2));
if(side=='prev'){
left=(path=='horizontal') ? parseInt(winW - object.offsetX - diff.W - (thumbsOffset.W / 2)):parseInt((winW / 2) - (width / 2) - diff.W - object.offsetY - (thumbsOffset.W / 2));
}else{
top=(path=='horizontal') ? top:parseInt(object.offsetX - diff.H - height - (thumbsOffset.H / 2)),
left=(path=='horizontal') ? parseInt(object.offsetX - diff.W - width - (thumbsOffset.W / 2)):parseInt((winW / 2) - object.offsetY - (width / 2) - diff.W - (thumbsOffset.W / 2));
}
$('div.ilightbox-container', secondHolder).animate({
width: width,
height: height
}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc':'easeInOutCirc');
secondHolder.addClass(firstClass).css(transform, gpuAcceleration).animate({
top: top,
left: left,
opacity: opts.styles.prevOpacity
}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc':'easeInOutCirc', function(){
secondHolder.css(transform, '');
$('.ilightbox-thumbnail', vars.thumbnails).removeClass('ilightbox-active').eq(item).addClass('ilightbox-active');
iL.positionThumbnails();
if(iL.items[item]){
if(!iL.items[item].options.mousewheel){ vars.lockWheel=true; }else{ vars.lockWheel=false; }
if(!iL.items[item].options.swipe){ vars.lockSwipe=true; }else{ vars.lockSwipe=false; }}
vars.isSwipe=false;
if(side=="next"){
vars.nextPhoto=lastHolder,
vars.prevPhoto=secondHolder,
vars.holder=firstHolder;
vars.nextPhoto.hide();
vars.next=vars.next + 1,
vars.prev=vars.current,
vars.current=vars.current + 1;
if(opts.infinite){
if(vars.current > vars.total - 1){ vars.current=0; }
if(vars.current==vars.total - 1){ vars.next=0; }
if(vars.current==0){ vars.prev=vars.total - 1; }}
iL.createUI();
if(!iL.items[vars.next]){
vars.nextLock=false;
}else{
iL.loadContent(iL.items[vars.next], 'next');
}}else{
vars.prevPhoto=lastHolder;
vars.nextPhoto=secondHolder;
vars.holder=firstHolder;
vars.prevPhoto.hide();
vars.next=vars.current;
vars.current=vars.prev;
vars.prev=vars.current - 1;
if(opts.infinite){
if(vars.current==vars.total - 1){ vars.next=0; }
if(vars.current==0){ vars.prev=vars.total - 1; }}
iL.createUI();
if(!iL.items[vars.prev]){
vars.prevLock=false;
}else{
iL.loadContent(iL.items[vars.prev], 'prev');
}}
if(opts.linkId){ setTimeout(function(){
vars.hashLock=false;
}, 55);
}
if(!opts.infinite){
vars.nextButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled');
if(vars.current==0){
vars.prevButton.add(vars.innerPrevButton).addClass('disabled');
}
if(vars.current >=vars.total - 1){
vars.nextButton.add(vars.innerNextButton).addClass('disabled');
}}
iL.repositionPhoto();
iL.resetCycle();
if(typeof opts.callback.onAfterChange=='function'){
opts.callback.onAfterChange.call(iL, iL.ui);
}});
top=(path=='horizontal') ? getPixel(lastHolder, 'top'):((side=="next") ? parseInt(-(winH / 2) - lastHolder.outerHeight()):parseInt(top * 2)),
left=(path=='horizontal') ? ((side=="next") ? parseInt(-(winW / 2) - lastHolder.outerWidth()):parseInt(left * 2)):getPixel(lastHolder, 'left');
lastHolder.css(transform, gpuAcceleration).animate({
top: top,
left: left,
opacity: opts.styles.nextOpacity
}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc':'easeInOutCirc', function(){
lastHolder.css(transform, '');
}).addClass(secondClass);
}},
setCaption: function(obj, target){
var iL=this,
caption=$('');
if(obj.caption){
caption.html(obj.caption);
$('div.ilightbox-container', target).append(caption);
}},
normalizeSocial: function(obj, url){
var iL=this,
vars=iL.vars,
opts=iL.options,
baseURL=window.location.href;
$.each(obj, function(key, value){
if(!value){
return true;
}
var item=key.toLowerCase(),
source, text;
switch (item){
case 'facebook':
source="http://www.facebook.com/share.php?v=4&src=bm&u={URL}",
text="Share on Facebook";
break;
case 'twitter':
source="http://twitter.com/home?status={URL}",
text="Share on Twitter";
break;
case 'googleplus':
source="https://plus.google.com/share?url={URL}",
text="Share on Google+";
break;
case 'delicious':
source="http://delicious.com/post?url={URL}",
text="Share on Delicious";
break;
case 'digg':
source="http://digg.com/submit?phase=2&url={URL}",
text="Share on Digg";
break;
case 'reddit':
source="http://reddit.com/submit?url={URL}",
text="Share on reddit";
break;
}
obj[key]={
URL: value.URL&&absolutizeURI(baseURL, value.URL)||opts.linkId&&window.location.href||typeof url!=='string'&&baseURL||url&&absolutizeURI(baseURL, url)||baseURL,
source: value.source||source||value.URL&&absolutizeURI(baseURL, value.URL)||url&&absolutizeURI(baseURL, url),
text: value.text||text||"Share on " + key,
width: (typeof(value.width)!='undefined'&&!isNaN(value.width)) ? parseInt(value.width):640,
height: value.height||360
};});
return obj;
},
setSocial: function(obj, url, target){
var iL=this,
socialBar=$(''),
buttons='';
obj=iL.normalizeSocial(obj, url);
$.each(obj, function(key, value){
var item=key.toLowerCase(),
source=value.source.replace(/\{URL\}/g, encodeURIComponent(value.URL).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+'));
buttons +=' ';
});
buttons +='
';
socialBar.html(buttons);
$('div.ilightbox-container', target).append(socialBar);
},
fullScreenAction: function(){
var iL=this,
vars=iL.vars;
if(fullScreenApi.supportsFullScreen){
if(fullScreenApi.isFullScreen()){ fullScreenApi.cancelFullScreen(document.documentElement); }else{ fullScreenApi.requestFullScreen(document.documentElement); }}else{
iL.doFullscreen();
}},
doFullscreen: function(){
var iL=this,
vars=iL.vars,
viewport=getViewport(),
opts=iL.options;
if(opts.fullAlone){
var currentHolder=vars.holder,
current=iL.items[vars.current],
windowWidth=viewport.width,
windowHeight=viewport.height,
elements=[currentHolder, vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.overlay, vars.toolbar, vars.thumbnails, vars.loader],
hideElements=[vars.loader, vars.thumbnails];
if(!vars.isInFullScreen){
vars.isInFullScreen=vars.lockKey=vars.lockWheel=vars.lockSwipe=true;
vars.overlay.css({
opacity: 1
});
$.each(hideElements, function(i, element){
element.hide();
});
vars.fullScreenButton.attr('title', opts.text.exitFullscreen);
if(opts.fullStretchTypes.indexOf(current.type)!=-1){ currentHolder.data({
naturalWidthOld: currentHolder.data('naturalWidth'),
naturalHeightOld: currentHolder.data('naturalHeight'),
naturalWidth: windowWidth,
naturalHeight: windowHeight
});
}else{
var viewport=current.options.fullViewPort||opts.fullViewPort||'',
newWidth=windowWidth,
newHeight=windowHeight,
width=currentHolder.data('naturalWidth'),
height=currentHolder.data('naturalHeight');
if(viewport.toLowerCase()=='fill'){
newHeight=(newWidth / width) * height;
if(newHeight < windowHeight){
newWidth=(windowHeight / height) * width,
newHeight=windowHeight;
}}else if(viewport.toLowerCase()=='fit'){
var dims=iL.getNewDimenstions(newWidth, newHeight, width, height, true);
newWidth=dims.width,
newHeight=dims.height;
}else if(viewport.toLowerCase()=='stretch'){
newWidth=newWidth,
newHeight=newHeight;
}else{
var scale=(width > newWidth||height > newHeight) ? true:false,
dims=iL.getNewDimenstions(newWidth, newHeight, width, height, scale);
newWidth=dims.width,
newHeight=dims.height;
}
currentHolder.data({
naturalWidthOld: currentHolder.data('naturalWidth'),
naturalHeightOld: currentHolder.data('naturalHeight'),
naturalWidth: newWidth,
naturalHeight: newHeight
});
}
$.each(elements, function(key, val){
val.addClass('ilightbox-fullscreen');
});
if(typeof opts.callback.onEnterFullScreen=='function'){ opts.callback.onEnterFullScreen.call(iL, iL.ui); }}else{
vars.isInFullScreen=vars.lockKey=vars.lockWheel=vars.lockSwipe=false;
vars.overlay.css({
opacity: iL.options.overlay.opacity
});
$.each(hideElements, function(i, element){
element.show();
});
vars.fullScreenButton.attr('title', opts.text.enterFullscreen);
currentHolder.data({
naturalWidth: currentHolder.data('naturalWidthOld'),
naturalHeight: currentHolder.data('naturalHeightOld'),
naturalWidthOld: null,
naturalHeightOld: null
});
$.each(elements, function(key, val){
val.removeClass('ilightbox-fullscreen');
});
if(typeof opts.callback.onExitFullScreen=='function'){ opts.callback.onExitFullScreen.call(iL, iL.ui); }}
}else{
if(!vars.isInFullScreen){ vars.isInFullScreen=true; }else{ vars.isInFullScreen=false; }}
iL.repositionPhoto(true);
},
closeAction: function(){
var iL=this,
vars=iL.vars,
opts=iL.options;
$win.unbind('.iLightBox');
$doc.off('.iLightBox');
if(vars.isInFullScreen){ fullScreenApi.cancelFullScreen(document.documentElement); }
$('.ilightbox-overlay, .ilightbox-holder, .ilightbox-thumbnails').off('.iLightBox');
if(opts.hide.effect){ vars.overlay.stop().fadeOut(opts.hide.speed, function(){
vars.overlay.remove();
vars.BODY.removeClass('ilightbox-noscroll').off('.iLightBox');
});
}else{
vars.overlay.remove();
vars.BODY.removeClass('ilightbox-noscroll').off('.iLightBox');
}
var fadeOuts=[vars.toolbar, vars.holder, vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.loader, vars.thumbnails];
$.each(fadeOuts, function(i, element){
element.removeAttr('style').remove();
});
vars.dontGenerateThumbs=vars.isInFullScreen=false;
window.iLightBox=null;
if(opts.linkId){
vars.hashLock=true;
removeHash();
setTimeout(function(){
vars.hashLock=false;
}, 55);
}
if(typeof opts.callback.onHide=='function'){ opts.callback.onHide.call(iL, iL.ui); }},
repositionPhoto: function(){
var iL=this,
vars=iL.vars,
opts=iL.options,
path=opts.path.toLowerCase(),
viewport=getViewport(),
winWidth=viewport.width,
winHeight=viewport.height;
var thumbsOffsetW=(vars.isInFullScreen&&opts.fullAlone||vars.isMobile) ? 0:((path=='horizontal') ? 0:vars.thumbnails.outerWidth()),
thumbsOffsetH=vars.isMobile ? vars.toolbar.outerHeight():((vars.isInFullScreen&&opts.fullAlone) ? 0:((path=='horizontal') ? vars.thumbnails.outerHeight():0)),
width=(vars.isInFullScreen&&opts.fullAlone) ? winWidth:(winWidth - (opts.styles.pageOffsetX)),
height=(vars.isInFullScreen&&opts.fullAlone) ? winHeight:(winHeight - (opts.styles.pageOffsetY)),
offsetW=(path=='horizontal') ? parseInt((iL.items[vars.next]||iL.items[vars.prev]) ? ((opts.styles.nextOffsetX + opts.styles.prevOffsetX)) * 2:(((width / 10) <=30) ? 30:(width / 10))):parseInt(((width / 10) <=30) ? 30:(width / 10)) + thumbsOffsetW,
offsetH=(path=='horizontal') ? parseInt(((height / 10) <=30) ? 30:(height / 10)) + thumbsOffsetH:parseInt((iL.items[vars.next]||iL.items[vars.prev]) ? ((opts.styles.nextOffsetX + opts.styles.prevOffsetX)) * 2:(((height / 10) <=30) ? 30:(height / 10)));
var elObject={
type: 'current',
width: width,
height: height,
item: iL.items[vars.current],
offsetW: offsetW,
offsetH: offsetH,
thumbsOffsetW: thumbsOffsetW,
thumbsOffsetH: thumbsOffsetH,
animate: arguments.length,
holder: vars.holder
};
iL.repositionEl(elObject);
if(iL.items[vars.next]){
elObject=$.extend(elObject, {
type: 'next',
item: iL.items[vars.next],
offsetX: opts.styles.nextOffsetX,
offsetY: opts.styles.nextOffsetY,
holder: vars.nextPhoto
});
iL.repositionEl(elObject);
}
if(iL.items[vars.prev]){
elObject=$.extend(elObject, {
type: 'prev',
item: iL.items[vars.prev],
offsetX: opts.styles.prevOffsetX,
offsetY: opts.styles.prevOffsetY,
holder: vars.prevPhoto
});
iL.repositionEl(elObject);
}
var loaderCss=(path=="horizontal") ? {
left: parseInt((width / 2) - (vars.loader.outerWidth() / 2))
}:{
top: parseInt((height / 2) - (vars.loader.outerHeight() / 2))
};
vars.loader.css(loaderCss);
},
repositionEl: function(obj){
var iL=this,
vars=iL.vars,
opts=iL.options,
path=opts.path.toLowerCase(),
widthAvail=(obj.type=='current') ? ((vars.isInFullScreen&&opts.fullAlone) ? obj.width:(obj.width - obj.offsetW)):(obj.width - obj.offsetW),
heightAvail=(obj.type=='current') ? ((vars.isInFullScreen&&opts.fullAlone) ? obj.height:(obj.height - obj.offsetH)):(obj.height - obj.offsetH),
itemParent=obj.item,
item=obj.item.options,
holder=obj.holder,
offsetX=obj.offsetX||0,
offsetY=obj.offsetY||0,
thumbsOffsetW=obj.thumbsOffsetW,
thumbsOffsetH=obj.thumbsOffsetH;
if(obj.type=='current'){
if(typeof item.width=='number'&&item.width){ widthAvail=((vars.isInFullScreen&&opts.fullAlone)&&(opts.fullStretchTypes.indexOf(itemParent.type)!=-1||item.fullViewPort||opts.fullViewPort)) ? widthAvail:((item.width > widthAvail) ? widthAvail:item.width);
}
if(typeof item.height=='number'&&item.height){ heightAvail=((vars.isInFullScreen&&opts.fullAlone)&&(opts.fullStretchTypes.indexOf(itemParent.type)!=-1||item.fullViewPort||opts.fullViewPort)) ? heightAvail:((item.height > heightAvail) ? heightAvail:item.height);
}}else{
if(typeof item.width=='number'&&item.width){ widthAvail=(item.width > widthAvail) ? widthAvail:item.width; }
if(typeof item.height=='number'&&item.height){ heightAvail=(item.height > heightAvail) ? heightAvail:item.height; }}
heightAvail=parseInt(heightAvail - $('.ilightbox-inner-toolbar', holder).outerHeight());
var width=(typeof item.width=='string'&&item.width.indexOf('%')!=-1) ? percentToValue(parseInt(item.width.replace('%', '')), obj.width):holder.data('naturalWidth'),
height=(typeof item.height=='string'&&item.height.indexOf('%')!=-1) ? percentToValue(parseInt(item.height.replace('%', '')), obj.height):holder.data('naturalHeight');
var dims=((typeof item.width=='string'&&item.width.indexOf('%')!=-1||typeof item.height=='string'&&item.height.indexOf('%')!=-1) ? {
width: width,
height: height
}:iL.getNewDimenstions(widthAvail, heightAvail, width, height)),
newDims=$.extend({}, dims, {});
if(obj.type=='prev'||obj.type=='next'){
width=parseInt(dims.width * ((obj.type=='next') ? opts.styles.nextScale:opts.styles.prevScale)),
height=parseInt(dims.height * ((obj.type=='next') ? opts.styles.nextScale:opts.styles.prevScale));
}else{
width=dims.width,
height=dims.height;
}
var widthDiff=parseInt((getPixel(holder, 'padding-left') + getPixel(holder, 'padding-right') + getPixel(holder, 'border-left-width') + getPixel(holder, 'border-right-width')) / 2),
heightDiff=parseInt((getPixel(holder, 'padding-top') + getPixel(holder, 'padding-bottom') + getPixel(holder, 'border-top-width') + getPixel(holder, 'border-bottom-width') + $('.ilightbox-inner-toolbar', holder).outerHeight()) / 2);
switch (obj.type){
case 'current':
var top=parseInt((obj.height / 2) - (height / 2) - heightDiff - (thumbsOffsetH / 2)),
left=parseInt((obj.width / 2) - (width / 2) - widthDiff - (thumbsOffsetW / 2));
break;
case 'next':
var top=(path=='horizontal') ? parseInt((obj.height / 2) - offsetY - (height / 2) - heightDiff - (thumbsOffsetH / 2)):parseInt(obj.height - offsetX - heightDiff - (thumbsOffsetH / 2)),
left=(path=='horizontal') ? parseInt(obj.width - offsetX - widthDiff - (thumbsOffsetW / 2)):parseInt((obj.width / 2) - (width / 2) - widthDiff - offsetY - (thumbsOffsetW / 2));
break;
case 'prev':
var top=(path=='horizontal') ? parseInt((obj.height / 2) - offsetY - (height / 2) - heightDiff - (thumbsOffsetH / 2)):parseInt(offsetX - heightDiff - height - (thumbsOffsetH / 2)),
left=(path=='horizontal') ? parseInt(offsetX - widthDiff - width - (thumbsOffsetW / 2)):parseInt((obj.width / 2) - offsetY - (width / 2) - widthDiff - (thumbsOffsetW / 2));
break;
}
holder.data('offset', {
top: top,
left: left,
newDims: newDims,
diff: {
W: widthDiff,
H: heightDiff
},
thumbsOffset: {
W: thumbsOffsetW,
H: thumbsOffsetH
},
object: obj
});
if(obj.animate > 0&&opts.effects.reposition){
holder.css(transform, gpuAcceleration).stop().animate({
top: top,
left: left
}, opts.effects.repositionSpeed, 'easeOutCirc', function(){
holder.css(transform, '');
});
$('div.ilightbox-container', holder).stop().animate({
width: width,
height: height
}, opts.effects.repositionSpeed, 'easeOutCirc');
$('div.ilightbox-inner-toolbar', holder).stop().animate({
width: width
}, opts.effects.repositionSpeed, 'easeOutCirc', function(){
$(this).css('overflow', 'visible');
});
}else{
holder.css({
top: top,
left: left
});
$('div.ilightbox-container', holder).css({
width: width,
height: height
});
$('div.ilightbox-inner-toolbar', holder).css({
width: width
});
}},
resume: function(priority){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(!opts.slideshow.pauseTime||opts.controls.slideshow&&vars.total <=1||priority < vars.isPaused){
return;
}
vars.isPaused=0;
if(vars.cycleID){
vars.cycleID=clearTimeout(vars.cycleID);
}
vars.cycleID=setTimeout(function(){
if(vars.current==vars.total - 1){ iL.goTo(0); }else{ iL.moveTo('next'); }}, opts.slideshow.pauseTime);
},
pause: function(priority){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(priority < vars.isPaused){
return;
}
vars.isPaused=priority||100;
if(vars.cycleID){
vars.cycleID=clearTimeout(vars.cycleID);
}},
resetCycle: function(){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(opts.controls.slideshow&&vars.cycleID&&!vars.isPaused){
iL.resume();
}},
getNewDimenstions: function(width, height, width_old, height_old, thumb){
var iL=this;
if(!width){ factor=height / height_old; }
else if(!height){ factor=width / width_old; }else{ factor=min(width / width_old, height / height_old); }
if(!thumb){
if(factor > iL.options.maxScale){ factor=iL.options.maxScale; }
else if(factor < iL.options.minScale){ factor=iL.options.minScale; }}
var final_width=(iL.options.keepAspectRatio) ? round(width_old * factor):width,
final_height=(iL.options.keepAspectRatio) ? round(height_old * factor):height;
return {
width: final_width,
height: final_height,
ratio: factor
};},
setOption: function(options){
var iL=this;
iL.options=$.extend(true, iL.options, options||{});
iL.refresh();
},
availPlugins: function(){
var iL=this,
testEl=document.createElement("video");
iL.plugins={
flash: false,
quicktime: (parseInt(PluginDetect.getVersion("QuickTime")) >=0) ? true:false,
html5H264: !!(testEl.canPlayType&&testEl.canPlayType('video/mp4').replace(/no/, '')),
html5WebM: !!(testEl.canPlayType&&testEl.canPlayType('video/webm').replace(/no/, '')),
html5Vorbis: !!(testEl.canPlayType&&testEl.canPlayType('video/ogg').replace(/no/, '')),
html5QuickTime: !!(testEl.canPlayType&&testEl.canPlayType('video/quicktime').replace(/no/, ''))
};},
addContent: function(element, obj){
var iL=this,
el;
switch (obj.type){
case 'video':
var HTML5=false,
videoType=obj.videoType,
html5video=obj.options.html5video;
if(((videoType=='video/mp4'||obj.ext=='mp4'||obj.ext=='m4v')||html5video.h264)&&iL.plugins.html5H264){
obj.ext='mp4',
obj.URL=html5video.h264||obj.URL;
}else if(html5video.webm&&iL.plugins.html5WebM){
obj.ext='webm',
obj.URL=html5video.webm||obj.URL;
}else if(html5video.ogg&&iL.plugins.html5Vorbis){
obj.ext='ogv',
obj.URL=html5video.ogg||obj.URL;
}
if(iL.plugins.html5H264&&(videoType=='video/mp4'||obj.ext=='mp4'||obj.ext=='m4v')){ HTML5=true, videoType="video/mp4"; }
else if(iL.plugins.html5WebM&&(videoType=='video/webm'||obj.ext=='webm')){ HTML5=true, videoType="video/webm"; }
else if(iL.plugins.html5Vorbis&&(videoType=='video/ogg'||obj.ext=='ogv')){ HTML5=true, videoType="video/ogg"; }
else if(iL.plugins.html5QuickTime&&(videoType=='video/quicktime'||obj.ext=='mov'||obj.ext=='qt')){ HTML5=true, videoType="video/quicktime"; }
if(HTML5){
el=$('', {
"width": "100%",
"height": "100%",
"preload": html5video.preload,
"autoplay": html5video.autoplay,
"poster": html5video.poster,
"controls": html5video.controls
}).append($('', {
"src": obj.URL,
"type": videoType
}));
}else{
if(!iL.plugins.quicktime){ el=$('', {
"class": "ilightbox-alert",
html: iL.options.errors.missingPlugin.replace('{pluginspage}', pluginspages.quicktime).replace('{type}', 'QuickTime')
});
}else{
el=$('', {
"type": "video/quicktime",
"pluginspage": pluginspages.quicktime
}).attr({
"data": obj.URL,
"width": "100%",
"height": "100%"
}).append($('', {
"name": "src",
"value": obj.URL
})).append($('', {
"name": "autoplay",
"value": "false"
})).append($('', {
"name": "loop",
"value": "false"
})).append($('', {
"name": "scale",
"value": "tofit"
}));
if(browser.msie){ el=QT_GenerateOBJECTText(obj.URL, '100%', '100%', '', 'SCALE', 'tofit', 'AUTOPLAY', 'false', 'LOOP', 'false'); }}
}
break;
case 'flash':
if(!iL.plugins.flash){ el=$('', {
"class": "ilightbox-alert",
html: iL.options.errors.missingPlugin.replace('{pluginspage}', pluginspages.flash).replace('{type}', 'Adobe Flash player')
});
}else{
var flashvars="",
i=0;
if(obj.options.flashvars){ $.each(obj.options.flashvars, function(k, v){
if(i!=0) flashvars +="&";
flashvars +=k + "=" + encodeURIComponent(v);
i++;
});
}else{ flashvars=null; }
el=$('').attr({
"type": "application/x-shockwave-flash",
"src": obj.URL,
"width": (typeof obj.options.width=='number'&&obj.options.width&&iL.options.minScale=='1'&&iL.options.maxScale=='1') ? obj.options.width:"100%",
"height": (typeof obj.options.height=='number'&&obj.options.height&&iL.options.minScale=='1'&&iL.options.maxScale=='1') ? obj.options.height:"100%",
"quality": "high",
"bgcolor": "#000000",
"play": "true",
"loop": "true",
"menu": "true",
"wmode": "transparent",
"scale": "showall",
"allowScriptAccess": "always",
"allowFullScreen": "true",
"flashvars": flashvars,
"fullscreen": "yes"
});
}
break;
case 'iframe':
var $query_array=obj.URL.substring(obj.URL.indexOf('?') + 1).split('&'),
$query_object={},
$query_string='?';
for(var $i=0; $i < $query_array.length; ++$i){
var $single_query=$query_array[$i].split('=');
if($single_query.length!=2) continue;
$query_object[$single_query[0]]=decodeURIComponent($single_query[1].replace(/\+/g, " "));
}
$query_string +=($query_object['autoplay']!==undefined) ? '&autoplay=' + $query_object['autoplay']:'';
$query_string +=($query_object['rel']!==undefined) ? '&rel=' + $query_object['rel']:'';
if(obj.URL.indexOf('vimeo.com')!=-1){
var $reg_exp=/http(s?):\/\/(www\.)?vimeo.com\/(\d+)/;
var $match=obj.URL.match($reg_exp);
if($match){
var $movie='//player.vimeo.com/video/'+ $match[3] +'?title=0&byline=0&portrait=0' + $query_string;
}else{
var $movie=obj.URL;
}}else{
var $reg_exp=/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
var $match=obj.URL.match($reg_exp);
if($match){
var $movie='//www.youtube.com/embed/' + $match[7] + $query_string;
}else{
var $movie=obj.URL;
}}
el=$('').attr({
"width": (typeof obj.options.width=='number'&&obj.options.width&&iL.options.minScale=='1'&&iL.options.maxScale=='1') ? obj.options.width:"100%",
"height": (typeof obj.options.height=='number'&&obj.options.height&&iL.options.minScale=='1'&&iL.options.maxScale=='1') ? obj.options.height:"100%",
src: $movie,
frameborder: 0,
'hspace': 0,
'vspace': 0,
'scrolling': supportTouch ? 'auto':'scroll',
'webkitAllowFullScreen': '',
'mozallowfullscreen': '',
'allowFullScreen': ''
});
break;
case 'inline':
el=$('').html($(obj.URL).clone(true));
break;
case 'html':
var object=obj.URL,
el;
if(object[0].nodeName){
el=$('').html(object);
}else{
var dom=$(obj.URL),
html=(dom.selector) ? $('' + dom + '
'):dom;
el=$('').html(html);
}
break;
}
$('div.ilightbox-container', element).empty().html(el);
if(el[0].tagName.toLowerCase()==='video'&&browser.webkit){ setTimeout(function(){
var src=el[0].currentSrc + '?' + floor(random() * 30000);
el[0].currentSrc=src;
el[0].src=src;
});
}
return el;
},
ogpRecognition: function(obj, callback){
var iL=this,
url=obj.URL;
iL.showLoader();
doAjax(url, function(data){
iL.hideLoader();
if(data){
var object=new Object();
object.length=false,
object.url=data.url;
if(data.status==200){
var result=data.results,
type=result.type,
source=result.source;
object.type=type,
object.html5video=result.html5video||{},
object.length=true;
if(result.images){
object.thumbnail=result.images[0];
}
if(source){
object.source=source.src,
object.width=source.width&&parseInt(source.width)||0,
object.height=source.height&&parseInt(source.height)||0,
object.thumbnail=source.thumbnail;
if(source.type=='application/x-shockwave-flash'){ object.type="flash"; }
else if(source.type.indexOf("video/")!=-1){ object.type="video"; }
else if(source.type.indexOf("/html")!=-1){ object.type="iframe"; }
else if(source.type.indexOf("image/")!=-1){ object.type="image"; }}
}else if(typeof data.response!='undefined'){
throw data.response;
}
callback.call(this, object.length ? object:false);
}});
},
hashChangeHandler: function(url){
var iL=this,
vars=iL.vars,
opts=iL.options,
URL=url||window.location.href,
hash=parseURI(URL).hash,
split=hash.split('/'),
index=split[1];
if(vars.hashLock||('#' + opts.linkId!=split[0]&&hash.length > 1)){ return; }
if(index){
var target=split[1]||0;
if(iL.items[target]){
var overlay=$('.ilightbox-overlay');
if(overlay.length&&overlay.attr('linkid')==opts.linkId){
iL.goTo(target);
}else{
iL.itemsObject[target].trigger(supportTouch ? 'itap':'click');
}}else{
var overlay=$('.ilightbox-overlay');
if(overlay.length){ iL.closeAction(); }}
}else{
var overlay=$('.ilightbox-overlay');
if(overlay.length){ iL.closeAction(); }}
}};
function getPixel($element, property){
return parseInt($element.css(property), 10)||0;
}
function within(number, min, max){
return number < min ? min:number > max ? max:number;
}
function getViewport(){
var e=window,
a='inner';
if(!('innerWidth' in window)){
a='client';
e=document.documentElement||document.body;
}
return {
width: e[a + 'Width'],
height: e[a + 'Height']
}}
function removeHash(){
if(history&&history.pushState){
history.pushState('', document.title, window.location.pathname + window.location.search);
}
}
function doAjax(url, callback){
var url="http://ilightbox.net/getSource/jsonp.php?url=" + encodeURIComponent(url).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A');
$.ajax({
url: url,
dataType: 'jsonp'
});
iLCallback=function(data){
callback.call(this, data);
};}
function findImageInElement(element){
var elements=$('*', element),
imagesArr=new Array();
elements.each(function(){
var url="",
element=this;
if($(element).css("background-image")!="none"){
url=$(element).css("background-image");
}else if(typeof($(element).attr("src"))!="undefined"&&element.nodeName.toLowerCase()=="img"){
url=$(element).attr("src");
}
if(url.indexOf("gradient")==-1){
url=url.replace(/url\(\"/g, "");
url=url.replace(/url\(/g, "");
url=url.replace(/\"\)/g, "");
url=url.replace(/\)/g, "");
var urls=url.split(",");
for (var i=0; i < urls.length; i++){
if(urls[i].length > 0&&$.inArray(urls[i], imagesArr)==-1){
var extra="";
if(browser.msie&&browser.version < 9){
extra="?" + floor(random() * 3000);
}
imagesArr.push(urls[i] + extra);
}}
}});
return imagesArr;
}
function getExtension(URL){
var ext=(URL) ? URL.split('.').pop().toLowerCase():'',
extra=ext.indexOf('?')!==-1 ? '?' + ext.split('?').pop():'';
return ext.replace(extra, '');
}
function getTypeByExtension(URL){
var type,
ext=getExtension(URL);
if(extensions.image.indexOf(ext)!==-1){ type='image'; }
else if(extensions.flash.indexOf(ext)!==-1){ type='flash'; }
else if(extensions.video.indexOf(ext)!==-1){ type='video'; }else{ type='iframe'; }
return type;
}
function percentToValue(percent, total){
return parseInt((total / 100) * percent);
}
function parseURI(url){
var m=String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
return (m ? {
href: m[0]||'',
protocol: m[1]||'',
authority: m[2]||'',
host: m[3]||'',
hostname: m[4]||'',
port: m[5]||'',
pathname: m[6]||'',
search: m[7]||'',
hash: m[8]||''
}:null);
}
function absolutizeURI(base, href){
var iL=this;
function removeDotSegments(input){
var output=[];
input.replace(/^(\.\.?(\/|$))+/, '')
.replace(/\/(\.(\/|$))+/g, '/')
.replace(/\/\.\.$/, '/../')
.replace(/\/?[^\/]*/g, function(p){
if(p==='/..'){
output.pop();
}else{
output.push(p);
}});
return output.join('').replace(/^\//, input.charAt(0)==='/' ? '/':'');
}
href=parseURI(href||'');
base=parseURI(base||'');
return !href||!base ? null:(href.protocol||base.protocol) +
(href.protocol||href.authority ? href.authority:base.authority) +
removeDotSegments(href.protocol||href.authority||href.pathname.charAt(0)==='/' ? href.pathname:(href.pathname ? ((base.authority&&!base.pathname ? '/':'') + base.pathname.slice(0, base.pathname.lastIndexOf('/') + 1) + href.pathname):base.pathname)) +
(href.protocol||href.authority||href.pathname ? href.search:(href.search||base.search)) +
href.hash;
}
function version_compare(v1, v2, operator){
this.php_js=this.php_js||{};
this.php_js.ENV=this.php_js.ENV||{};
var i=0,
x=0,
compare=0,
vm={
'dev': -6,
'alpha': -5,
'a': -5,
'beta': -4,
'b': -4,
'RC': -3,
'rc': -3,
'#': -2,
'p': 1,
'pl': 1
},
prepVersion=function(v){
v=('' + v).replace(/[_\-+]/g, '.');
v=v.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.');
return (!v.length ? [-8]:v.split('.'));
},
numVersion=function(v){
return !v ? 0:(isNaN(v) ? vm[v]||-7:parseInt(v, 10));
};
v1=prepVersion(v1);
v2=prepVersion(v2);
x=max(v1.length, v2.length);
for (i=0; i < x; i++){
if(v1[i]==v2[i]){
continue;
}
v1[i]=numVersion(v1[i]);
v2[i]=numVersion(v2[i]);
if(v1[i] < v2[i]){
compare=-1;
break;
}else if(v1[i] > v2[i]){
compare=1;
break;
}}
if(!operator){
return compare;
}
switch (operator){
case '>':
case 'gt':
return (compare > 0);
case '>=':
case 'ge':
return (compare >=0);
case '<=':
case 'le':
return (compare <=0);
case '==':
case '=':
case 'eq':
return (compare===0);
case '<>':
case '!=':
case 'ne':
return (compare!==0);
case '':
case '<':
case 'lt':
return (compare < 0);
default:
return null;
}}
$.fn.iLightBox=function(){
var args=arguments,
opt=($.isPlainObject(args[0])) ? args[0]:args[1],
items=($.isArray(args[0])||typeof args[0]=='string') ? args[0]:args[1];
if(!opt){ opt={};}
var options=$.extend(true, {
attr: 'href',
path: 'vertical',
skin: 'dark',
linkId: false,
infinite: false,
startFrom: 0,
randomStart: false,
keepAspectRatio: true,
maxScale: 1,
minScale: .2,
innerToolbar: false,
smartRecognition: false,
mobileOptimizer: true,
fullAlone: true,
fullViewPort: null,
fullStretchTypes: 'flash, video',
overlay: {
blur: true,
opacity: .85
},
controls: {
arrows: false,
slideshow: false,
toolbar: true,
fullscreen: true,
thumbnail: true,
keyboard: true,
mousewheel: true,
swipe: true
},
keyboard: {
left: true,
right: true,
up: true,
down: true,
esc: true,
shift_enter: true
},
show: {
effect: true,
speed: 300,
title: true
},
hide: {
effect: true,
speed: 300
},
caption: {
start: true,
show: 'mouseenter',
hide: 'mouseleave'
},
social: {
start: true,
show: 'mouseenter',
hide: 'mouseleave',
buttons: false
},
styles: {
pageOffsetX: 0,
pageOffsetY: 0,
nextOffsetX: 45,
nextOffsetY: 0,
nextOpacity: 1,
nextScale: 1,
prevOffsetX: 45,
prevOffsetY: 0,
prevOpacity: 1,
prevScale: 1
},
thumbnails: {
maxWidth: 120,
maxHeight: 80,
normalOpacity: 1,
activeOpacity: .6
},
effects: {
reposition: true,
repositionSpeed: 200,
switchSpeed: 500,
loadedFadeSpeed: 180,
fadeSpeed: 200
},
slideshow: {
pauseTime: 5000,
pauseOnHover: false,
startPaused: true
},
text: {
close: "Press Esc to close",
enterFullscreen: "Enter Fullscreen (Shift+Enter)",
exitFullscreen: "Exit Fullscreen (Shift+Enter)",
slideShow: "Slideshow",
next: "Next",
previous: "Previous"
},
errors: {
loadImage: "An error occurred when trying to load photo.",
loadContents: "An error occurred when trying to load contents.",
missingPlugin: "The content your are attempting to view requires the {type} plugin<\/a>."
},
ajaxSetup: {
url: '',
beforeSend: function(jqXHR, settings){},
cache: false,
complete: function(jqXHR, textStatus){},
crossDomain: false,
error: function(jqXHR, textStatus, errorThrown){},
success: function(data, textStatus, jqXHR){},
global: true,
ifModified: false,
username: null,
password: null,
type: 'GET'
},
callback: {}}, opt);
var instant=($.isArray(items)||typeof items=='string') ? true:false;
items=$.isArray(items) ? items:new Array();
if(typeof args[0]=='string'){ items[0]=args[0]; }
if(version_compare($.fn.jquery, '1.8', '>=')){
var iLB=new iLightBox($(this), options, items, instant);
return {
close: function(){
iLB.closeAction();
},
fullscreen: function(){
iLB.fullScreenAction();
},
moveNext: function(){
iLB.moveTo('next');
},
movePrev: function(){
iLB.moveTo('prev');
},
goTo: function(index){
iLB.goTo(index);
},
refresh: function(){
iLB.refresh();
},
reposition: function(){
(arguments.length > 0) ? iLB.repositionPhoto(true): iLB.repositionPhoto();
},
setOption: function(options){
iLB.setOption(options);
},
destroy: function(){
iLB.closeAction();
iLB.dispatchItemsEvents();
}};}else{
throw "The jQuery version that was loaded is too old. iLightBox requires jQuery 1.8+";
}};
$.iLightBox=function(){
return $.fn.iLightBox(arguments[0], arguments[1]);
};
$.extend($.easing, {
easeInCirc: function(x, t, b, c, d){
return -c * (sqrt(1 - (t /=d) * t) - 1) + b;
},
easeOutCirc: function(x, t, b, c, d){
return c * sqrt(1 - (t=t / d - 1) * t) + b;
},
easeInOutCirc: function(x, t, b, c, d){
if((t /=d / 2) < 1){ return -c / 2 * (sqrt(1 - t * t) - 1) + b; }
return c / 2 * (sqrt(1 - (t -=2) * t) + 1) + b;
}});
function getScrollXY(){
var scrOfX=0,
scrOfY=0;
if(typeof(window.pageYOffset)=='number'){
scrOfY=window.pageYOffset;
scrOfX=window.pageXOffset;
}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){
scrOfY=document.body.scrollTop;
scrOfX=document.body.scrollLeft;
}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){
scrOfY=document.documentElement.scrollTop;
scrOfX=document.documentElement.scrollLeft;
}
return {
x: scrOfX,
y: scrOfY
};}
(function(){
$.each(("touchstart touchmove touchend " +
"tap taphold " +
"swipeleft swiperight " +
"scrollstart scrollstop").split(" "), function(i, name){
$.fn[name]=function(fn){
return fn ? this.bind(name, fn):this.trigger(name);
};
if($.attrFn){
$.attrFn[name]=true;
}});
var tapSettings={
startEvent: 'touchstart.iTap',
endEvent: 'touchend.iTap'
};
$.event.special.itap={
setup: function(){
var self=this,
$self=$(this),
start, stop;
$self.bind(tapSettings.startEvent, function(event){
start=getScrollXY();
$self.one(tapSettings.endEvent, function(event){
stop=getScrollXY();
var orgEvent=event||window.event;
event=$.event.fix(orgEvent);
event.type="itap";
if((start&&stop)&&(start.x==stop.x&&start.y==stop.y))($.event.dispatch||$.event.handle).call(self, event);
start=stop=undefined;
});
});
},
teardown: function(){
$(this).unbind(tapSettings.startEvent);
}};}());
(function(){
fullScreenApi={
supportsFullScreen: false,
isFullScreen: function(){
return false;
},
requestFullScreen: function(){},
cancelFullScreen: function(){},
fullScreenEventName: '',
prefix: ''
},
browserPrefixes='webkit moz o ms khtml'.split(' ');
if(typeof document.cancelFullScreen!='undefined'){
fullScreenApi.supportsFullScreen=true;
}else{
for (var i=0, il=browserPrefixes.length; i < il; i++){
fullScreenApi.prefix=browserPrefixes[i];
if(typeof document[fullScreenApi.prefix + 'CancelFullScreen']!='undefined'){
fullScreenApi.supportsFullScreen=true;
break;
}}
}
if(fullScreenApi.supportsFullScreen){
fullScreenApi.fullScreenEventName=fullScreenApi.prefix + 'fullscreenchange';
fullScreenApi.isFullScreen=function(){
switch (this.prefix){
case '':
return document.fullScreen;
case 'webkit':
return document.webkitIsFullScreen;
default:
return document[this.prefix + 'FullScreen'];
}};
fullScreenApi.requestFullScreen=function(el){
return (this.prefix==='') ? el.requestFullScreen():el[this.prefix + 'RequestFullScreen']();
};
fullScreenApi.cancelFullScreen=function(el){
return (this.prefix==='') ? document.cancelFullScreen():document[this.prefix + 'CancelFullScreen']();
};}}());
(function(){
function uaMatch(ua){
ua=ua.toLowerCase();
var match=/(chrome)[ \/]([\w.]+)/.exec(ua) ||
/(webkit)[ \/]([\w.]+)/.exec(ua) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
/(msie) ([\w.]+)/.exec(ua) ||
ua.indexOf("compatible") < 0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua)||[];
return {
browser: match[1]||"",
version: match[2]||"0"
};}
var matched=uaMatch(navigator.userAgent);
browser={};
if(matched.browser){
browser[matched.browser]=true;
browser.version=matched.version;
}
if(browser.chrome){
browser.webkit=true;
}else if(browser.webkit){
browser.safari=true;
}}());
(function(){
var prefixes=['', 'webkit', 'moz', 'ms', 'o'];
var el=document.createElement('div');
function testProp(prop){
for (var p=0, pl=prefixes.length; p < pl; p++){
var prefixedProp=prefixes[p] ? prefixes[p] + prop.charAt(0).toUpperCase() + prop.slice(1):prop;
if(el.style[prefixedProp]!==undefined){
return prefixedProp;
}}
}
transform=testProp('transform')||'';
gpuAcceleration=testProp('perspective') ? 'translateZ(0) ':'';
}());
var PluginDetect={version:"0.7.9",name:"PluginDetect",handler:function(c,b,a){return function(){c(b,a)}},openTag:"<",isDefined:function(b){return typeof b!="undefined"},isArray:function(b){return(/array/i).test(Object.prototype.toString.call(b))},isFunc:function(b){return typeof b=="function"},isString:function(b){return typeof b=="string"},isNum:function(b){return typeof b=="number"},isStrNum:function(b){return(typeof b=="string"&&(/\d/).test(b))},getNumRegx:/[\d][\d\.\_,-]*/,splitNumRegx:/[\.\_,-]/g,getNum:function(b,c){var d=this,a=d.isStrNum(b)?(d.isDefined(c)?new RegExp(c):d.getNumRegx).exec(b):null;return a?a[0]:null},compareNums:function(h,f,d){var e=this,c,b,a,g=parseInt;if(e.isStrNum(h)&&e.isStrNum(f)){if(e.isDefined(d)&&d.compareNums){return d.compareNums(h,f)}c=h.split(e.splitNumRegx);b=f.split(e.splitNumRegx);for(a=0;ag(b[a],10)){return 1}if(g(c[a],10)c||!(/\d/).test(e[a])){e[a]="0"}}return e.slice(0,4).join(",")},$$hasMimeType:function(a){return function(c){if(!a.isIE&&c){var f,e,b,d=a.isArray(c)?c:(a.isString(c)?[c]:[]);for(b=0;b2||!f||!f.version||!(e=h.getNum(f.version))){return b}if(!b){return e}e=h.formatNum(e);b=h.formatNum(b);d=b.split(h.splitNumRegx);g=e.split(h.splitNumRegx);for(a=0;a-1&&a>c&&d[a]!="0"){return b}if(g[a]!=d[a]){if(c==-1){c=a}if(d[a]!="0"){return b}}}return e},AXO:window.ActiveXObject,getAXO:function(a){var f=null,d,b=this,c={};try{f=new b.AXO(a)}catch(d){}return f},convertFuncs:function(f){var a,g,d,b=/^[\$][\$]/,c=this;for(a in f){if(b.test(a)){try{g=a.slice(2);if(g.length>0&&!f[g]){f[g]=f[a](f);delete f[a]}}catch(d){}}}},initObj:function(e,b,d){var a,c;if(e){if(e[b[0]]==1||d){for(a=0;a=0;h=h-2){if(g[h]&&new RegExp(g[h],"i").test(b)){d.OS=g[h+1];break}}};d.head=i.getElementsByTagName("head")[0]||i.getElementsByTagName("body")[0]||i.body||null;d.isIE=new Function("return/*@cc_on!@*/!1")();d.verIE=d.isIE&&(/MSIE\s*(\d+\.?\d*)/i).test(l)?parseFloat(RegExp.$1,10):null;d.verIEfull=null;d.docModeIE=null;if(d.isIE){var f,n,c=document.createElement("div");try{c.style.behavior="url(#default#clientcaps)";d.verIEfull=(c.getComponentVersion("{89820200-ECBD-11CF-8B85-00AA005B4383}","componentid")).replace(/,/g,".")}catch(f){}n=parseFloat(d.verIEfull||"0",10);d.docModeIE=i.documentMode||((/back/i).test(i.compatMode||"")?5:n)||d.verIE;d.verIE=n||d.docModeIE};d.ActiveXEnabled=false;if(d.isIE){var h,m=["Msxml2.XMLHTTP","Msxml2.DOMDocument","Microsoft.XMLDOM","ShockwaveFlash.ShockwaveFlash","TDCCtl.TDCCtl","Shell.UIHelper","Scripting.Dictionary","wmplayer.ocx"];for(h=0;h0&&c.isFunc(b[0])))){a.push(b)}},callArray:function(b){var c=this,a;if(c.isArray(b)){for(a=0;a0&&b.isFunc(c[0])){c[0](b,a>1?c[1]:0,a>2?c[2]:0,a>3?c[3]:0)}else{if(b.isFunc(c)){c(b)}}},getVersionDelimiter:",",$$getVersion:function(a){return function(g,d,c){var e=a.init(g),f,b,h={};if(e.status<0){return null};f=e.plugin;if(f.getVersionDone!=1){f.getVersion(null,d,c);if(f.getVersionDone===null){f.getVersionDone=1}}a.cleanup();b=(f.version||f.version0);b=b?b.replace(a.splitNumRegx,a.getVersionDelimiter):b;return b}},cleanup:function(){var a=this;if(a.garbage&&a.isDefined(window.CollectGarbage)){window.CollectGarbage()}},isActiveXObject:function(d,b){var f=this,a=false,g,c='"}function QT_GenerateOBJECTText(){return _QTGenerate("QT_GenerateOBJECTText",!1,arguments)};
(function(){function e(a){a=a||location.href;return"#"+a.replace(/^[^#]*#?(.*)$/,"$1")}var k=document,b,f=$.event.special,p=k.documentMode,m="oniLightBoxHashChange"in window&&(void 0===p||7').hide().one("load",function(){d||n(e());a()}).attr("src",d||
"javascript:0").insertAfter("body")[0].contentWindow,k.onpropertychange=function(){try{"title"===event.propertyName&&(c.document.title=k.title)}catch(a){}})};h.stop=b;f=function(){return e(c.location.href)};n=function(a,d){var b=c.document,e=$.fn.iLightBoxHashChange.domain;a!==d&&(b.title=k.title,b.open(),e&&b.write('